0% found this document useful (0 votes)
27 views5 pages

SQL Intview Ques

The document discusses differences between database management systems (DBMS) and relational database management systems (RDBMS), as well as key concepts in SQL including primary keys, foreign keys, constraints, and types of SQL commands. It defines a DBMS as software that defines, creates and maintains a database, while an RDBMS specifically stores and manages data in tables. It describes primary keys as columns that uniquely identify table rows, foreign keys as columns referring to primary keys in other tables, and common constraint types like NOT NULL, UNIQUE, PRIMARY KEY and FOREIGN KEY. Finally, it outlines the five main types of SQL commands: DDL, DML, DQL, DCL and TCL along with examples.

Uploaded by

Aryan Bhatia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views5 pages

SQL Intview Ques

The document discusses differences between database management systems (DBMS) and relational database management systems (RDBMS), as well as key concepts in SQL including primary keys, foreign keys, constraints, and types of SQL commands. It defines a DBMS as software that defines, creates and maintains a database, while an RDBMS specifically stores and manages data in tables. It describes primary keys as columns that uniquely identify table rows, foreign keys as columns referring to primary keys in other tables, and common constraint types like NOT NULL, UNIQUE, PRIMARY KEY and FOREIGN KEY. Finally, it outlines the five main types of SQL commands: DDL, DML, DQL, DCL and TCL along with examples.

Uploaded by

Aryan Bhatia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Q1 Differentiate DBMS vs RDBMS?

Ans Database management system DBMS is a software that is used to define create and
maintain a database and provide control access to data.

RDBMS is used to store or manage only the data that is in the form of tables .

Example of RDBMS is my SQL, postgre SQL, IBM DB2, SQL Server, Oracle, Microsoft Access,
Amazon redshift etc.

Q2 What is a primary key?

Ans-A primary key is a column or a group of colums that uniquely identifies the rows of data
in that table.

PK=Unique + NOT NUL

Q3 What is a Foreign Key

Ans - .A FOREIGN KEY is a column (or a group of columns) in one table that refers to the
PRIMARY KEY in another table.

.The table with foreign key is called the child table,and the table with the primary key is
called the referenced or parent table.

.It maintains referential integrity in database.

Q4 What are constraints and its type?

Ans- .SQL constraints are used to specify rules for the data in a table.

.NOT NULL- Ensures that a column cannot have a NULL value.

.UNIQUE- Ensures that all value in a column are different.

.PRIMARY KEY- A combination of a NOT NULL and UNIQUE.Uniquely identifies each row
in a table.

.FOREIGN KEY - Prevents action that would destroylinks between tables.

.CHECK- Ensures that values in a coumn satisfies a specific condition.

.DEFAULT- Sets a default value for a column if no value is specified.


Q5 Explain different types of SQL commands?

Ans

Types Of SQL Commands : Introduction


 SQL Categorizes its commands on the basis of functionalities performed
by them. There are five types of SQL Commands which can be classified
as:
o DDL(Data Definition Language).
o DML(Data Manipulation Language).
o DQL(Data Query Language).
o DCL(Data Control Language).
o TCL(Transaction Control Language).

Types Of SQL Commands : Data Definition Language(DDL)

 In order to make/perform changes on the physical structure of any table


residing inside a database, DDL is used. These commands when executed
are auto commit in nature and all the changes in the table are reflected
and saved immediately. DDL commands includes :
SQL DDL Commands

Types Of SQL Commands : Data Manipulation Language(DML)

 Once the tables are created and database is generated using DDL
commands, manipulation inside those tables and databases is done using
DML commands. The advantage of using DML commands is, if in case
any wrong changes or values are made, they can be changes and rolled
back easily. DML commands includes :

SQL DML Commands

Types Of SQL Commands : Data Control Language(DCL)


 DCL commands as the name suggests manages the matters and issues
related to the data control in any database. TCL commands mainly
provides special privilege access to users and is also used to specify the
roles of users accordingly. There are two commonly used DCL commands,
these are:

SQL DCL Commands

Types Of SQL Commands : Data Query Language(DQL)

 Data query language consists of only one command over which data
selection in SQL relies. SELECT command in combination with other SQL
clauses is used to retrieve and fetch data from database/tables on the
basis of certain conditions applied by user.

SQL DQL Command

Types Of SQL Commands : Transaction Control Language(TCL)

 Transaction Control Language as the name suggests manages the issues


and matters related to the transactions in any database. They are used to
rollback or commit the changes in the database.
 Roll back means “Undo” the changes and Commit means “Applying” the
changes. There are three major TCL commands.
SQL TCL Commands

Q6 Differentiate between DELETE,DROP,TRUNCATE?

Ans-

You might also like