SQL Interview Questions and Answers

SQL Interview Questions and Answers

I) Introduction to SQL and Database Management Systems

II) SQL Syntax

III) SQL Data Types

IV) SQL Operators

V) SQL Functions

VI) Subsets of SQL

VII) Data Definition Language

VIII) Data Manipulation Language

IX) Data Control Language

X) SQL Keys

XI) SQL Select

XII) SQL Simple Queries


XIV) SQL Views

XV) Normalization
SQL Interview Questions
SQL For Database Developers, Testers, and Administrators 
1) What is Database?

Database is nothing but an organized form of data for easy access, storing, retrieval and managing of data. This is also known as structured form of data which can be accessed in many ways.

Example: School Database, Bank Database, Insurance Database, Hospital Database Etc...

2) What is Table in a Database?

A Table is a collection of records of a specific type. For example, employee table, salary table etc.

3) What is Field in a Database?

A field is an area within a record reserved for a specific piece of data. 

Examples: Employee Name, Employee ID etc.

4) What is Record in a Database?

A record is the collection of values / fields of a specific entity: i.e. an Employee, Salary etc.

5) What is DBMS?

The Database Management System is a collection of programs that enables user to store, retrieve, update and delete information from a database.

6) What is RDBMS?

Relational Database Management system (RDBMS) is a database management system (DBMS) that is based on the relational model. Data from relational database can be accessed or reassembled in many different ways without having to reorganize the database tables. Data from relational database can be accessed using an API, Structured Query Language (SQL).

7) What are the Popular Database Management Systems in the IT Industry?

Oracle, MySQL, Microsoft SQL Server, PostgreSQL, SyBase, MongoDB, DB2, and Microsoft Access Etc...

8) What is Oracle RDBMS?

Oracle Database or Oracle RDBMS is an Object Relational Database Management System from the Oracle Corporation.

Oracle database is the first database designed for enterprise grid computing. The enterprise grid computing provides the most flexible and cost effective way to manage information and applications.

9) What is MySQL?

MySQL is a database management system that allows us to manage relational databases. It is open source software backed by Oracle. Even though MySQL is open source software, you can buy a commercial license version from Oracle to get a premium support services.

10) What is Microsoft SQL Server?

SQL Server is a Relational Database Management System (RDBMS) developed by Microsoft. 

It is also an ORDBMS, Platform dependent, both GUI and command based software and SQL Language which is an IBM product (Freeware).

11) What is SQL?

SQL was initially developed at IBM in 1970s, It is the standard language to communicate with relational database management systems like Oracle, MS Access, MS SQL Server, MySQL, DB2, Sybase Etc...

12) What are the purposes of SQL?

•  SQL is used to Create New Databases, Create New Tables in a Database, Insert records in a Database, Update records in a Database, Delete records in a Database, Retrieve data from a Database, and Execute queries against a Database.

•  SQL can set Permissions on Tables, Procedures and Views. 

•  SQL is used for Database Developers to create and manipulate Database Objects.

•  SQL is used for Database Testers to conduct Database Testing.

•  SQL is used for Database Database Administators (DBA) for Database Administration.

13) Who should learn SQL?

i) Database Developers to Design and deploy Database Table Structures, Forms, Reports and Queries etc...

ii) Database Administrators (DBA) for Keeping Databases up to date and managing database access, Writing reports, documentation and operating manuals.

iii) Database Testers to Verify Data Integrity, Data Manipulations (Add, Update and Delete), and Data Comparison.

14) What are the Subsets of SQL?

SQL Commands can be classified in to groups based on their nature, they are,
i) Data Definition Language
ii) Data Manipulation Language
iii) Data Control Language

15) What are the Important Commands and Operations in Data Definition Language?

Important Commands and Operations in Data Definition Language

i) Create: To create databases and database objects

ii) Alter: To modify existing database objects

iii) Drop: To drop databases and databases objects

iv) Truncate: To remove all records from a table

v) Rename: To rename database objects

16) What are the Important Commands and Operations in Data Manipulation Language?

Important Commands and Operations in Data Manipulation Language

i) Select: To select specific data from a database

ii) Insert: To insert new records in a table

iii) Update: To update existing records 

iv) Delete: To delete existing records from a table

17) What are the Important Commands and Operations in Data Control Language?

Important Commands and Operations in Data Control Language

i) Grant: To provide access on the Database objects to the users

ii) Revoke: to remove user access rights to the database objects

iii) Deny: To deny permissions to users.

18) What is Index?

An index is performance tuning method of allowing faster retrieval of records from the table. An index creates an entry for each value and it will be faster to retrieve data.

19) What is View?

The views are virtual tables. Unlike tables that contain data, views simply contain queries that dynamically retrieve data when used.

20) What is Join? 

Join is a query, which retrieves related columns or rows from multiple tables. 

21) What is Normalization?

Normalization is the process of minimizing redundancy and dependency by organizing fields and table of a database. The main aim of Normalization is to add, delete or modify field that can be made in a single table.

22) What is Primary key? 

A Primary Key is a type of a constraint enforcing uniqueness and data integrity for each row of a table. All columns participating in a primary key constraint must possess the NOT NULL property.

23) What is Foreign key?

A Foreign key is one table which can be related to the primary key of another table. Relationship needs to be created between two tables by referencing foreign key with the primary key of another table.

24) What is Stored procedure?

A Stored Procedure is a function which contains a collection of SQL Queries. The procedure can take inputs, process them and send back output.

25) What is Trigger?

When a Database is inserted, deleted or updated, a procedure is executed in response to that action, such SQL procedures are called as Triggers.

Example: When a new student is added to the student database, new records should be created in the related tables like Exam, Score and Attendance tables.

26) What is SQL* Plus?

SQL* Plus is a command line tool proprietary to Oracle. You can send SQL queries to the server using the tool. It can also help you format the result of a query.

27) What is PL/SQL?

PL/SQL stands for procedural language extension to SQL. It supports procedural features of programming language and SQL both. It was developed by Oracle Corporation in early of 90's to enhance the capabilities of SQL.

28) What is T-SQL?

T-SQL (Transact-SQL) is a set of programming extensions from Sybase and Microsoft that add several features to the Structured Query Language (SQL). 

29) How to use SQL?

We can use SQL Commands in any Database Management System, Install any Database Engine like Oracle, SQL Server, Sybase, MySQL etc... and use.

30 Explain about SQL Syntax?

•  SQL keywords are NOT case sensitive: select is the same as SELECT

•  All the SQL statements start with any of the keywords like SELECT, INSERT, UPDATE, DELETE etc...and all the statements end with a semicolon (;), semicolon is the standard way to separate SQL Statements.

31) Explain SQL Data Types?

• A data type defines what kind of value a column can contain, we have to use data types while creating database tables, choose a particular data type for a table column based on our requirement.


Character Data Types,
Numeric Data Types,
Date and Time Data Types Etc...

Note: Data Types vary from One Database Management System to another

32) What are Operators and categories of Operators in SQL?

Operators are used to perform Arithmetic, Comparison and Logical Operations.

Categories of Operators in SQL

1) Arithmetic Operators
2) Comparison Operators
3) Logical Operators


Good questions, thank you sir.

could you please provide depth questions each topic

I am planning to provide depth questions on every SQL topic.

sir pls provide ETL testing concepts,teradata,cognos,informatica,interview questions...

Post a Comment