Below you will find pages that utilize the taxonomy term “database”
Blog
MongoDB Listing Database Collections/Tables with Number of Records/Rows
Use following script and command to quickly get the number of records/rows in the collections/tables in a database.
mongo-ls.js script:
1var collections = db.getCollectionNames(); 2for (var i = 0; i < collections.length; ++i) { 3 print(collections[i] + ' - ' + db[collections[i]].count() + ' records'); 4} So, copy-paste this script in to text file and save as mongo-ls.js.
Finally, use the following command to query the database. Make sure you change HOSTNAME, DBNAME, USERNAME and PASSWORD with your own.
Blog
How to Generate Database EER Diagrams from SQL Scripts using MySQL Workbench
MySQL Workbench makes it really easy to generate EER diagrams from SQL scripts. Follow below steps to make one for yourself.
Download and install MySQL Workbench for your system.
See below simple SQL commands, later I’ll use them to generate a sample diagram.
1create table country ( 2 id integer primary key, 3 name CHAR(55)); 4 5create table city ( 6 id integer primary key, 7 country_id integer, 8 name CHAR(55), 9 foreign key (country_id) references country(id)); Open MySQL Workbench and create a new model (File -> New Model).
Blog
Get Size of MySQL Databases
Use below query in MySQL command prompt to get a table of databases and their sizes in MB.
SELECT table_schema "DB Name", Round(Sum(data_length + index_length) / 1024 / 1024, 1) "DB Size in MB" FROM information_schema.tables GROUP BY table_schema;
Blog
How to Set Up a MySQL Database for a Mezzanine Project
Install MySQL server and python-mysqldb package:
sudo apt-get install mysql-server sudo apt-get install python-mysqldb Run MySQL:
mysql -u root -p Create a database:
mysql> create database mezzanine_project; Confirm it:
mysql> show databases; Exit:
mysql> exit Configure local_settings.py:
cd path/to/your/mezzanine/projectnano local_settings.py Like following:
1DATABASES = { 2 "default": { 3 "ENGINE": "django.db.backends.mysql", 4 "NAME": "mezzanine_project", 5 "USER": "root", 6 "PASSWORD": "123456", 7 "HOST": "", 8 "PORT": "", 9 } 10 } Note: Replace your password
Blog
Retrieving Data with AJAX using jQuery, PHP and MySQL
Last semester, I took a course from Informatics Institute at METU called “Biological Databases and Data Analysis Tools” where first we learned what is a database and how to do queries on it. Also, the technology behind databases are taught. Then, we learned many biological databases and data analysis tools available. These include gene, protein and pathway databases, tools for creating databases.
As a final project, we were asked to create an online tool that can search a database and get the data and display it on any web browsers.