SQL Interview Questions and Answers – Part 1
1) Write an SQL Query to find the names of the employees starting with ‘A’?
Answer: The below is the answer for this question:
Select name from Employees where name like 'A%';
For detailed answer and explanation of this answer, you can check the below youtube video:
2) Write an SQL Query to display the current date?
Answer: The below is the answer for this question:
MySQL: Select curdate(); Select current_date(); Oracle: Select current_date from Dual;
For detailed answer and explanation of this answer, you can check the below youtube video:
3) Difference between SQL, MySQL and SQL Server
Answer: The below is the answer for this question:
SQL Stands for Structured Query Langauge, which contains the different SQL statements for querying against the DB Tables in different RDBMS Software.
MySQL and SQL Server are the two different RDBMS Software.
For detailed answer and explanation of this answer, you can check the below youtube video:
4) What are the different types of SQL Statements?
Answer: The below is the answer for this question:
All the SQL Statements can be categorized into the below different types:
- DQL
- DML
- DDL
- TCL
- DCL
For detailed answer and explanation of this answer, you can check the below youtube video:
5) What is a Table and Field in SQL?
Answer: The below is the answer for this question:
In RDBMS Database Management Systems like MySQL, Oracle etc., the date is stored in the form of Tables. Tables organizes the date in the form of rows and columns. Where as Fields are the different columns available in the table.
For detailed answer and explanation of this answer, you can check the below youtube video:
6) What is the difference between Primary Key and Unique Key?
Answer: The below is the answer for this question:
Primary Key = Unique + Not Null
For detailed answer and explanation of this answer, you can check the below youtube video:
7) What are the different types of DBMS?
Answer: The below is the answer for this question:
- Hierarchical
- Network
- Relational
- NoSQL
- ER Model
- Graph
- Document
- Object-Oriented
For detailed answer and explanation of this answer, you can check the below youtube video:
8) What are the types of Operators available in SQL?
Answer: The below is the answer for this question:
- Arithmetic Operators
- Comparision Operators
- Logical Operators
- SQL Bitwise Operators
- SQL Compound Operators
For detailed answer and explanation of this answer, you can check the below youtube video:
9) What is a Query?
Answer: The below is the answer for this question:
SQL Stands for Structed Query Language. A Set of Queries has formed together to form a SQL Language.
An inquiry or query performed on the set of data in the database is nothing but an SQL Query.
Example: For finding the list of employees in a company, we have to use the below SQL Query:
Select * from Employees where CompanyName='XYZ';
For detailed answer and explanation of this answer, you can check the below youtube video:
10) What is a Sub Query?
Answer: The below is the answer for this question:
A Query inside another Query is known as Sub Query.
Example: Write an SQL Query which uses the Sub Query concept, to find all the customers who has purchased from the store from which the Customer named ‘Mary’ has purchased.
Select * from Customers where store_id = (Select store_id from Customer where first_name='Mary');
For detailed answer and explanation of this answer, you can check the below youtube video:
Please leave your questions/comments/feedback below.
Happy Learning 🙂
Arun Motoori ( www.QAFox.com )