Top 5 SQL Interview Questions

Put your programming skills to the test in these challenges.

Top 5 SQL Interview Questions

Post by soldi3r on Sat Oct 28, 2017 1:27 pm
([msg=94854]see Top 5 SQL Interview Questions[/msg])

Going for a SQL job interview? If yes, here’s the most asked SQL interview questions that will help you great in the interview.

1. What is DBMS and RDBMS?

Database Management System (DBMS) is a program that controls creation, maintenance and use of a database. DBMS can be termed as File Manager that manages data in a database rather than saving it in file systems.
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.

2. What is database testing?

Database testing is checking the integrity of actual data in the front end with the data present in the database. It involves validating the data in the database, checking that there are no orphan records (record with a foreign key to a parent record that has been deleted”), no junk records are present, updating records in database and verify the value in the front end.

3. Write SQL Query to find second highest salary of Employee from the table Employee.

There are many ways to find second highest salary of Employee in SQL, you can either use SQL Join or sub query to solve this problem. Here is SQL query.
select MAX(Salary) from Employee WHERE Salary NOT IN (select MAX(Salary) from Employee );

4. What is PL/SQL? Also structure of PL/SQL?

PL/SQL is a programming language. SQL and procedural programming language constructs such as named blocks,iterations, conditional branching.
PL/SQL uses block structure as its basic two structure. Anonymous blocks or nested blocks can be used in PL/SQL.

5. What is the difference between primary key and unique key?

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.
Primary key constraint has automatic unique constraint defined on it.

Unique key constraint uniquely identified each record in the database. This provides uniqueness for the column or set of columns.
There can be many unique constraint defined per table, but only one Primary key constraint defined per table.

Composite key is a primary key with multiple columns as in case of some tables a single field might not guarantee unique and not null values, so a combination of multiple fields is taken as primary key.

Foreign key is used for enforcing referential integrity in which a field marked as foreign key in one table is linked with primary key of another table.

These are the top 5 SQL interview questions, you can read all the top most asked SQL interview questions and Oracle interview questions here.. Hope these will be very helpful in the interview. Good luck..
New User
New User
Posts: 7
Joined: Sun Sep 17, 2017 5:07 pm
Blog: View Blog (0)

Return to Programming

Who is online

Users browsing this forum: No registered users and 0 guests