Prepare your SQL interview in less than 10 minutes (1/2)

Nachiket Rajput
4 min readApr 18, 2022

--

  1. What is DBMS?

Ans : A Database Management System is a program that controls creation, maintenance and use of a database. It can be termed as File Manager that manages data in a database rather than saving it in file systems.

2. What is RDBMS?

Ans : RDBMS stands for Relational Database Management System. It 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.

3. What is SQL?

Ans : SQL stands for Structured Query Language , and it is used to communicate with the Database. This is a standard language used to perform tasks such as retrieval, updation, insertion and deletion of data from a database.

4. What is Primary Key?

Ans : The Primary Key constraint uniquely identifies each record in a table. It must contain UNIQUE values, and cannot contain NULL values.

A table can have only ONE primary key in the table, this primary key can consist of single or multiple columns.

Example :

CREATE TABLE Student (
ID int NOT NULL,
LastName varchar(255) NOT NULL,
FirstName varchar(255),
Age int,
PRIMARY KEY (ID)
);

5. What is Unique Key?

Ans : The Unique constraint ensures that all values in a column are different.

Both the Unique and Primary Key constraints provide a guarantee for uniqueness for a column or set of columns.

A Primary Key constraint automatically has a Unique constraint.

However, you can have many Unique constraints per table, but only one Primary Key constraint per table.

Example :

CREATE TABLE Student (
ID int NOT NULL UNIQUE,
LastName varchar(255) NOT NULL,
FirstName varchar(255),
Age int
);

6. What is Foreign Key?

Ans : 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.

Example :

CREATE TABLE Subject (
SubjectID int NOT NULL,
SubjectNo int NOT NULL,
StudentID int,
PRIMARY KEY (SubjectID),
FOREIGN KEY (StudentID) REFERENCES Student(ID)
);

7. What is Joins? Type of Joins.

A JOIN clause is used to combine rows from two or more tables, based on a related column between them.

  • Inner Join : It returns records that have matching values in both tables.
  • Left Outer Join : It returns all records from the left table and the matched records from the right table.
  • Right Outer Join : It returns all records from the right table and the matched records from the left table.
  • Full Outer Join : It returns all records when there is a match in either left or right table.

8. What is Indexing ? Types of Index.

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

i. Clustered Index : This type of index reorders the physical order of the table and search based on the key values. Each table can have only one clustered index.

2. Non-Clustered Index : NonClustered Index does not alter the physical order of the table and maintains logical order of data. Each table can have 999 nonclustered indexes.

9. TRUNCATE vs DELETE

Ans: DELETE command is used to remove rows from the table and WHERE clause can be used for conditional set of parameters. Commit and Rollback can be possible after delete statement.

TRUNCATE removes all rows from the table. Truncate operation cannot be rolled back.

10. TRUNCATE vs DROP

Ans : TRUNCATE removes all the rows from the table and cannot be rolled back.

DROP command removes a table from the database and operation cannot be rolled back.

That’s it for part -I.

Hope this will help you to crack your SQL Interview. I’ll discuss more strategies in a future blog post! Stay tuned for part-II

Do like, follow for upcoming posts.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Nachiket Rajput
Nachiket Rajput

Written by Nachiket Rajput

Developer | Writer | Career Generalist | Blogger | Community Person

No responses yet

Write a response