Category Archives: SQL

Database Interview Questions

Theory site:
Another Resource:

SQL Join – Interview Clear

In below:  The relationship between the two tables is specified by the customer_id key, which is the “primary key” in customers table and a “foreign key” in the orders table:

customer_id first_name last_name email address city state zipcode
1 George Washington [email protected] 3200 Mt Vernon Hwy Mount Vernon VA 22121
2 John Adams [email protected] 1250 Hancock St Quincy MA 02169
3 Thomas Jefferson [email protected] 931 Thomas Jefferson Pkwy Charlottesville VA 22902
4 James Madison [email protected] 11350 Constitution Hwy Orange VA 22960
5 James Monroe [email protected] 2050 James Monroe Parkway Charlottesville VA 22902
order_id order_date amount customer_id
1 07/04/1776 $234.56 1
2 03/14/1760 $78.50 3
3 05/23/1784 $124.00 2
4 09/03/1790 $65.50 3

Note that (1) not every customer in our customers table has placed an order and (2) there are a few orders for which no customer record exists in our customers table.

Inner Join Query:


first_name last_name order_date amount
george washington 07/04/1776 $234.56
john adams 05/23/1784 $124.00
Thomas Jefferson 03/14/1760 $78.50
Thomas Jefferson 09/03/1790 $65.50






Good Learning Site for beginners:


Less Important But Okay:

Dive into some SQL queries

In my 7th semester Level-3 Term -1 of my  BSc. Engineering course of Computer Science and Engineering in Daffodil International Univeristy(DIU) I am doing a course named Database Management System

Here our course teacher is using MS SQL Server 2008. I am sharing here what i have learnt from my class.

SQL stands for structured query language which help us to manage database easily

To create database in sql
Suppose a databse for university student

where we will create a table named student

after this we can show the empty table by this query


Now by this query  we will insert data into the table

Don’t forget to use values.It is actually SQL syntax and don’t forget to give
select * from statement at the end of the query as it will help to display the updated table where star or asterisks sign * means all info of this table

if we want to show some limited data from all then here is one example


Now I am going to update some of my data in the table then

2015-01-27 00_51_59-
Now I am going to delete some data from the table


2015-01-27 00_56_50-

Then here see the change.Age name with 22 and 23 have been deleted for this sql command.

We have used here OR statement because AND is not working in MS SQL Server 2008.I don’t know why…May be I don’t know the actual things about and/or in MS SQL. I apologize for this..

If this tutorial helped you to understand the basics of the sql query.Then don’t forget to keep soem comment below.

Thanks for reading 🙂