Home » Archive

Articles in the Database Category

Database, MongoDB »

[27 Jun 2017 | Comments Off on MongoDB: Basic Select, Insert, Update, Delete – CRUD [Beginner Tutorial]]

MongoDB is an open-source document database. Document in MongoDB means a row or record in the database. A document contains data in key-value pairs. MongoDB is popular for it’s high performance, scalability and availability.
This article shows how to perform simple select, insert, update, delete database operations in MongoDB. That’s also referred as CRUD (Create, Read, Update, Delete) operation. We will be performing these operations through terminal/command-prompt using MongoDB shell.

Database, MySQL »

[4 Apr 2016 | Comments Off on MySQL: Get size of all databases and tables]

This article shows SQL query to get size (in MB) of all MySQL databases. It also shows the query to get the size (in MB) of all the tables present in any particular database.
Get size (in MB) of all MySQL databases

Database, MySQL »

[7 Feb 2012 | Comments Off on Alter MySQL table to add & drop column & add Foreign Key]

This article shows:-

– How to add column to mysql database table after the table has already been created
– How to delete column from mysql database table after the table has already been created

Database, MySQL »

[18 Jul 2011 | 3 Comments]

Some definitions of foreign key:-
A FOREIGN KEY in one table points to a PRIMARY KEY in another table.
A foreign key is a field in a relational table that matches the primary key of another table. The foreign key can be used to cross-reference tables. A table may have multiple foreign keys, and each foreign key can have a different referenced table.

Database, MySQL, SQL »

[15 May 2010 | 2 Comments]

The JOIN keyword is used in an SQL statement to query data from two or more tables, based on a relationship between certain columns in these tables. [@via w3schools]
A SQL JOIN clause combines records from two or more tables in a database. It creates a set that can be saved as a table or used as is. A JOIN is a means for combining fields from two tables by using values common to each. ANSI standard SQL specifies four types of JOINs: INNER, OUTER, LEFT, and RIGHT. In special cases, …

Database, SQL »

[10 Mar 2009 | 2 Comments]

Error description:
Cannot insert the value NULL into column ‘SourceId’, table ‘Advisory.dbo.AdvDocSource’; column does not allow nulls. INSERT fails.
The statement has been terminated. The ‘CompanyAdd’ procedure attempted to return a status of NULL, which is not allowed. A status of 0 will be returned instead.

This error occurs because the ‘SourceId’ column in my table is primary key and it is set to not null. i.e. it doesn’t allow null entries. And I have not made it auto increment.

Database, MySQL »

[10 Oct 2007 | Comments Off on MySQL: Backup/Export and Restore/Import Database & Table]

This article shows how to backup/export and restore/import single & multiple databases and tables in MySQL.