SQL Interview Important Questions

SQL Interview Questions

Q 1) What is DBMS?

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

Q 2) What is RDBMS?

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

Q 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.

Q 4) What is a Database?

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

Q 5) What is a primary key?

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

Q 6) What is a unique key?

Ans:- A Unique key constraint uniquely identified each record in the database. This provides uniqueness for the column or set of columns.

Q 7) What is a 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.

Q 8) What is a join?

Ans:- This is a keyword used to query data from more tables based on the relationship between the fields of the tables. Keys play a major role when JOINs are used.

Q 9) What is Denormalization?

Ans:- DeNormalization is a technique used to access the data from higher to lower normal forms of database. It is also process of introducing redundancy into a table by incorporating data from the related tables.

Q 10) First Normal Form (1NF):.

Ans:- This should remove all the duplicate columns from the table. Creation of tables for the related data and identification of unique columns.

Q 11) Second Normal Form (2NF):.

Ans:- Meeting all requirements of the first normal form. Placing the subsets of data in separate tables and Creation of relationships between the tables using primary keys.

Q 12) Third Normal Form (3NF):.

Ans:- This should meet all requirements of 2NF. Removing the columns which are not dependent on primary key constraints.

Q 13) Fourth Normal Form (3NF):.

Ans:- Meeting all the requirements of third normal form and it should not have multi- valued dependencies.

Q 14) What is a trigger?

Ans:- A DB trigger is a code or programs that automatically execute with response to some event on a table or view in a database. Mainly, trigger helps to maintain the integrity of the database.

Q 15) What is a constraint?

Ans:- Constraint can be used to specify the limit on the data type of table. Constraint can be specified while creating or altering the table statement. Sample of constraint are.

  • CHECK.

Q 16) What is Cross-Join?

Ans:- Cross join defines as Cartesian product where number of rows in the first table multiplied by number of rows in the second table. If suppose, WHERE clause is used in cross join then the query will work like an INNER JOIN.

Q 17) What is collation?

Ans:- Collation is defined as set of rules that determine how character data can be sorted and compared. This can be used to compare A and, other language characters and also depends on the width of the characters.

Q 18) What is an ALIAS command?

Ans:- ALIAS name can be given to a table or column. This alias name can be referred in WHERE clause to identify the table or column.

 Select st.StudentID, Ex.Result from student st, Exam as Ex where st.studentID = Ex. StudentID

Q 19) What is a Query?

Ans:- A query is a request for data or information from a database table or combination of tables. A database query can be either a select query or an action query.

SELECT fname, lname 		 /* select query */
FROM myDb.students
WHERE student_id = 1;

Q 20) What is OLTP?

Ans:- OLTP stands for Online Transaction Processing, is a class of software applications capable of supporting transaction-oriented programs. An essential attribute of an OLTP system is its ability to maintain concurrency. To avoid single points of failure, OLTP systems are often decentralized. These systems are usually designed for a large number of users who conduct short transactions.