437710336788405
Frequently Asked Interview Questions : SQL Basics
Placement season is on and aspirants having the basic understanding of SQL are making the most of it. The most widely used RDBMS that uses SQL are Access, Microsoft SQL Server, and Oracle. As one of the standard language for relational database systems, it is used to extract data and update data on a database and with the advent of Big Data Analytics, the demand of SQL is at an all-time high. So to help aspirants with their interviews, we are listing the most common SQL interview questions asked in placement for the session 2018-19.
SQL Interview Questions
1. What is Standard Query Language (SQL)?
Standard Query Language (SQL) is a standard language used to interact with relational databases. It is used in data manipulation operations like inserting, deletion, fetching, modifying data in a database.
2. What is a Database?
A database is a collection of meaningful data stored for faster access and manipulation. It is a handy tool when it comes to data management on a huge scale. SQL contains mix database objects like tables, views, schema etc. which makes data management easy.
Few examples of databases are:
The database of Facebook which may include all its users, their list of friends, activities, reactions, the advertisements etc.
Videos on YouTube which includes their duration, views, impression, running advertisements, demographics etc.
3. What is Database Management System (DBMS)?
Database Management System (DBMS) is a system software used in database creation and management. It allows users to create, read, update and delete data from any database. This is used to manage the data, the database engine for data manipulation, and the schema which interprets the logical structure of a database.
4. What is Relational Database Management System (RDBMS)?
Relational Database Management System (RDBMS) is a database management system which operates on a relational model. It is a set of program that helps in the creation, update, and administration of a relational database and is accessed by SQL.
5. List a few of the most popular Database Management Systems.
Oracle, MongoDB, MySQL, MS SQL Server, PostgreSQL, Sybase, and Microsoft Access etc. are some of the most popular RDBMS used in the industry.
6. Explain Field and Record.
A field in a Database table is a space allocated to store a particular record within a table whereas record or the row of data is the ordered set of related data in a table.
7. List the types Of SQL Commands?
SQL commands can be listed as below:
DDL – Data Definition Language
 CREATE
ALTER
DROP
TRUNCATE
RENAME
DQL – Data Query Language
SELECT
INSERT
UPDATE
DELETE
TCL – Transaction Control Language
COMMIT
ROLLBACK
DCL – Data Control Language
GRANT
DENY
REVOKE
DML – Data Manipulation Language
SELECT
INSERT
UPDATE
DELETE
8. What Is An Index?
An index is used to speed up the performance of queries. It makes faster retrieval of data from the table. The index can be created on one column or a group of columns.
9. What Is A View?
A view is like a subset of a table which is stored logically in a database. A view is a virtual table. It contains rows and columns similar to a real table. The fields in the view are fields from one or more real tables. Views do not contain data of their own. They are used to restrict access to the database or to hide data complexity.
10. What is Subquery and what are the types of Subquery?
A subquery is a query inside an outer SQL query and is used to return data to be used in the outer (main) query. It acts as a condition and further restricts the data to be retrieved as the subquery is executed first with the result being passed to the main query. This can be used with statements as well as operators.
The different types of subquery are:
Correlated
Non-Correlated
11. What Are SQL Constraints? Give some examples.
SQL constraints are the restriction while manipulating data in SQL databases. Few of the most used constraints are: Foreign Key, SQL Not Null, Unique Key, Primary Key, Default,
12. What Is Normalization? What are its types?
Normalization is a table design process which minimizes the redundancies in data.
The different types of normalization forms used in SQL are:
First Normal Form (1NF): Removes all duplicate columns from a table
First Normal Form (2NF): Places data subsets in tables and uses primary keys to define the relationship between tables.
Third Normal Form (3NF): Removes columns which are not related through primary key
Fourth Normal Form (4NF): Also known as BCNF, these do not define multi-valued dependencies
13. What are Stored Procedures?
Stored Procedures are the collection of SQL statements stored in a database and are created to perform particular tasks. They accept input parameters, process them and return single values as results.
14. What are the ACID Properties?
ACID properties ensure that transactions in the databases are processes in a reliable manner. ACID stands for Atomicity, Consistency, Isolation, and Durability.
15. What are Aggregate functions in SQL? List some of them.
Aggregate functions return a single value after calculations in any column.
Few of the aggregate functions in SQL are:
AVG() : Average value
COUNT() : Number of rows
MAX() : Largest value
MIN() : Smallest value
ROUND() : Rounds off a numeric field to the number of decimals specified
SUM() : Adds data in column
16. What Is SQL Injection?
SQL injection is a method of attacking any database by inserting malicious SQL statements into the entry fields. Once the statement is executed the database becomes vulnerable and the attacker gets the access to it. The technique targets Data-Driven Applications for accessing sensitive data and control administrative tasks on databases.
17. What Is The Difference Between SQL And MySQL?
SQL is used to access and manipulate a relational database, while MySQL is itself a relational database and SQL remains its standard database language.
18. What Is SQL Sandbox in SQL Server?
SQL Sandbox is a protected SQL Server Environment and is used to execute untrusted scripts. Available SQL sandboxes are:
Safe Access Sandbox: Allows creation of stored procedures, triggers etc. but restricts access to memory and file creation.
External Access Sandbox: Allows access to files but users can’t manipulate memory allocation.
Unsafe Access Sandbox: Hosts untrusted codes with memory access.
19. What are Normalization and Denormalization?
Normalization is used to minimize redundancy and dependency in a database. It organizes fields and table of a database so that add, delete or modify field are possible from a single table.
Denormalization helps to introduce redundancy into the table by accessing data from separate logical tables.
20. What is the difference between DELETE and TRUNCATE commands?
DELETE command remove rows from the table, but requires to delete permissions on the target table by using the WHERE clause.
TRUNCATE SQL query is used to remove rows from a table, without initiating the individual row deletions.
UA-139666654-1 437710336788405744-707-6180