SQL Interview Questions & Answers

SQL Interview Questions

SQL Interview Questions:

I want to discuss about SQL Interview Questions for beginners.

1. What is DBMS?

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

2. What is RDBMS?

RDBMS stands for Relational Database Management System. RDBMS store the data into the collection of tables, which is related by common fields between the columns of the table. It also provides relational operators to manipulate the data stored into the tables.

RDBMS is a database management system (DBMS) that is based on the relational model. Data from a relational database can be accessed using Structured Query Language (SQL).

Example: SQL Server.

3. What is SQL?

SQL stands for Structured Query Language , and it is used to communicate with the Database. It is an American National Standard Institute (ANSI) standard. This is a standard language used to perform tasks such as retrieval, updation, insertion and deletion of data from a database.

Standard SQL Commands are Select.

4. What are the different types of SQL commands?

SQL commands are segregated into the following types:

  • DDL – Data Definition Language
  • DML – Data Manipulation Language
  • DQL – Data Query Language
  • DCL – Data Control Language
  • TCL – Transaction Control Language

5. What are the different DDL commands in SQL?
DDL commands are used to define or alter the structure of the database.

  • CREATE: To create databases and database objects
  • ALTER: To alter existing database objects
  • DROP: To drop databases and databases objects
  • TRUNCATE: To remove all records from a table but not its database structure
  • RENAME: To rename database objects

6.What are the different DML commands in SQL?

DML commands are used for managing data present in the database.

  • SELECT: To select specific data from a database
  • INSERT: To insert new records into a table
  • UPDATE: To update existing records
  • DELETE: To delete existing records from a table

7. What are the different DCL commands in SQL?

DCL commands are used to create roles, grant permission and control access to the database objects.

  • GRANT: To provide user access
  • DENY: To deny permissions to users
  • REVOKE: To remove user access

8. What are the different TCL commands in SQL?

TCL commands are used to manage the changes made by DML statements.

  • COMMIT: To write and store the changes to the database
  • ROLLBACK: To restore the database since the last commit

9. What is a Database?

A database is a collection of information in an organized form for faster and better access, storage and manipulation. It can also be defined as a collection of tables, schema, views, and other database objects.

10. What are tables and Fields?

A table is a set of data that are organized in a model with Columns and Rows. Columns can be categorized as vertical, and Rows are horizontal. A table has specified number of column called fields but can have any number of rows which is called record.

11. What is a primary key?

A primary key is a combination of fields which uniquely specify a row. This is a special kind of unique key, and it has implicit NOT NULL constraint. It means, Primary key values cannot be NULL.

12.What are various DDL commands in SQL? Give brief description of their purposes.

Following are various DDL or Data Definition Language commands in SQL –

  • CREATE – it creates a new table, a view of a table, or other object in database.
  • ALTER – it modifies an existing database object, such as a table.
  • DROP – it deletes an entire table, a view of a table or other object in the database.

13.What are various DML commands in SQL? Give brief description of their purposes.

Following are various DML or Data Manipulation Language commands in SQL –

  • SELECT – it retrieves certain records from one or more tables.
  • INSERT – it creates a record.
  • UPDATE – it modifies records.
  • DELETE – it deletes records.

14.What are various DCL commands in SQL? Give brief description of their purposes.

Following are various DCL or Data Control Language commands in SQL –

  • GRANT – it gives a privilege to user.
  • REVOKE – it takes back privileges granted from user.

15. What is the purpose of the condition operators BETWEEN and IN?

The BETWEEN operator displays rows based on a range of values. The IN condition operator checks for values contained in a specific set of values.

16.What are the types of DBMS?

There are two types of DBMS
1. Relational Database Management System (RDBMS)
2. Non-Relational Database Management System

17. What are the popular Database Management Systems in the IT Industry?

Oracle, MySQL, Microsoft SQL Server, PostgreSQL, Sybase, MongoDB, DB2, and Microsoft Access etc.,

 

Thanks for reading.

 

 

Share and Enjoy !

0Shares
0 0

Leave a Reply

Your email address will not be published. Required fields are marked *