SQL interview questions part 1

SQL stands for Structured Query Language. It is used in databases to manipulate and retrieve data from database. It mainly used in relational databases.

When you attending any software interview, you will get the questions from SQL. Because it is the basic language and easy one too.

Let us discuss the interview questions....

Before starting the SQL, you must know about database and RDBMS.

A database is a collection of data stored in a system in an organized  way. Using SQL, you can retrieve the data.

RDBMS (Relational Database Management system)is a software which is used to create, retrieve ,update and manage the database. The data is stored in the form of tables.

Next, SQL interview questions are given below….

1.What is SQL?

    SQL is Structured Query Language which is used to define ,retrieve and manipulate  

    data from databases.

 

2.Name some SQL servers.

    Some examples are MySQL,PostgreSQL,Oracle,Microsoft SQL server, SQLite.                                                                                                


3.What is a tuple?

    A tuple is a set of values of an individual record. For example, In Class A table, a  

   record of a student is called a tuple.


Class A

Student name

Roll no

Rank

Ajay

1

5

Baby

2

10

Charlie

3

6


             

4.What is DDL?

      DDL stands for Data Definition Language. It is used to define things in SQL.

       Eg: CREATE,ALTER,DROP,TRUNCATE,COMMENT,RENAME  

 

 5.What is DML?

        DML is Data Manipulation Language which is used to manipulate data. it is  

     used to store, modify, retrieve, delete and update data in a database. It has  

     following SQL commands   

      SELECT,INSERT,UPDATE,DELETE,MERGE,CALL,EXPLAIN PLAN,

      LOCK TABLE.

 

6.What is DCL?

   DCL is Data Control Language which is used to grant permissions and controls the   

  database. It includes GRANT ,REVOKE commands.

 

7.What is TCL?

     TCL is Transaction Control Language. It is used in transactions of a database. It includes  

   COMMIT,ROLLBACK,SAVEPOINT and SET TRANSACTION commands.


8. How to create table in SQL?

    To create table in SQL, follow the given syntax.

    Create table table_name(column1 datatype, column2 datatype,.....,column n datatype);

    Eg: Create table student(stu_name varchar(20), stu_id INT PRIMARY KEY,stu_class 

     varchar(10)); 

 

9.How to insert data in to a table in SQL?

      To insert a data, the syntax is given below. INSERT INTO 

    table_name(column1,column2,...) VALUES(VALUE1,VALUE2,....)

    Eg: INSERT INTO student(stu_name,stu_id,stu_class) values(‘ajay’,1,’commerce’);

 10.How  to select a row in SQL?

      This command is used to display the records in the database. It has the following  

       syntax

SELECT * FROM table_name;

SELECT Column_name(s) FROM table_name;

Eg: SELECT * FROM student;

It displays the entire records from table student.

These are some basic interview questions of SQL. Part 2 contains the advance concepts of SQL.

No comments:

Post a Comment