InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
What has stored procedures in SQL and how we can use it? |
|
Answer» It is a SET of precompiled SQL STATEMENTS that are used to perform a particular TASK. A procedure has a name, a PARAMETER list, and SQL statement, etc. It will help in reduce network traffic and increase the performance. Example CREATE PROCEDURE simple_function AS SELECT first_name, last_name FROM employee; EXEC simple_function; |
|
| 2. |
How to use distinct and count in SQL query? Explain |
|
Answer» count(): It returns the NUMBER of rows in a table satisfying the condition SPECIFIED in the WHERE clause. It would return 0 if there were no MATCHING conditions. Syntax: distinct(): It is used to return only different values. In a table, a column often contains many duplicate values, and sometimes we want to list the different values. It can be used with aggregates functions. Syntax:
This information was frequently asked during SQL interview QUESTIONS for testers. |
|
| 3. |
Explain CLAUSE in SQL? |
|
Answer» It is the source of a rowset to be operated upon in a DML STATEMENT. These clauses are very common which is used with Select statement, UPDATE statement and Delete statement. SQL provides with the following clauses that are GIVEN below:
|
|
| 4. |
Write a query to find the names of users that begin with "um" in SQL? |
| Answer» | |
| 5. |
Explain the difference between DROP and TRUNCATE commands in SQL? |
|
Answer» TRUNCATE
You can download here sql INTERVIEW questions pdf after registeration or subscribe.
|
|
| 6. |
Write a query to display the current date in SQL? |
|
Answer» SELECT CURDATE(); |
|
| 7. |
Explain Foreign key in SQL? |
|
Answer» It is a collection of fields in one table that uniquely identifies a ROW of another table. In SIMPLE words, the foreign KEY is defined in a second table, but it refers to the primary key/unique key in the first table. |
|
| 8. |
Explain Unique key in SQL. |
|
Answer» It is a SET of ONE or more than one fields or COLUMNS of a table that uniquely identify a record in the table. It is little like a PRIMARY key, but it can accept only one null value. |
|
| 9. |
Explain table and field in SQL? |
|
Answer» Table: It is a collection of RELATED data that consists of rows and COLUMNS. It has a specified NUMBER of columns but can have any number of rows. Field: It is a COLUMN in a table that is designed to maintain specific INFORMATION about all records in the table. |
|
| 10. |
What is a Database? Explain |
|
Answer» It is a COLLECTION of data that is organized to be EASILY accessed, managed and UPDATED. It is distributed into rows, COLUMNS, and tables. It's indexed to make it easier to find related information. |
|
| 11. |
Who introduced SQL? |
|
Answer» It was INITIALLY DEVELOPED in the early 1970S at IBM by Donald D. Chamberlin and Raymond F. Boyce. |
|
| 12. |
What are the advantages of SQL? Explain |
|
Answer» There are many ADVANTAGES of SQL, and some of them are mentioned below:
|
|
| 13. |
How to make a copy values from one column to another in SQL? |
| Answer» | |
| 14. |
Explain Aggregate functions are available there in SQL? |
|
Answer» The aggregate function performs a calculation on a set of values, and it RETURNS a single value as output. It ignores NULL values when it performs calculation except for the COUNT function.
SQL PROVIDES many aggregate functions that are listed below.
|
|
| 15. |
Explain Scalar functions in SQL? |
|
Answer» It is a function that takes one or more values but RETURNS a single value. It is BASED on USER INPUT and returns a single value.
|
|
| 16. |
Explain ALIAS in SQL? |
|
Answer» It is used to RENAME a table in a specific SQL statement. Renaming is a temporary CHANGE without change actual table NAME in the database. It can be applied to tables as well as fields. The BASIC SYNTAX of a table alias The basic syntax of a column alias |
|
| 17. |
How to find 3rd highest salary of an employee from the employee table in SQL? |
|
Answer» SELECT salary FROM employee E1 WHERE 3-1 = (SELECT COUNT(DISTINCT salary) FROM employee e2 WHERE e2.salary > e1.salary)
Our updated SQL interview questions queries for FRESHERS are the best online resource to help you prepare for the upcoming interviews. |
|
| 18. |
Explain Normalization and what are the advantages of it? |
|
Answer» It is a systematic approach of decomposing tables to REMOVE data redundancy and undesirable characteristics like Insertion, Update and Deletion. Normalization is a multi-step process that put data into the tabular form and removing duplicated data from the tables. Advantages
|
|
| 19. |
What is Trigger in SQL? Explain |
|
Answer» In SQL, a trigger is a database object that is associated with a table. It will be activated when a defined ACTION is executed for the table. It can be PERFORMED when you run one of the FOLLOWING SQL like INSERT, UPDATE and DELETE occurred in a table. It's activation TIME can be BEFORE or AFTER. |
|
| 20. |
Explain the difference between SQL and MySQL. |
Answer»
|
|
| 21. |
What is the difference between HAVING and a WHERE in SQL? |
|
Answer» WHERE CLAUSE is used for FILTERING rows, and it applies to every row but HAVING TERM is used to filter groups. WHERE can be used without the GROUP BY but HAVING clause cannot be used without the GROUP BY. |
|
| 22. |
Explain Constraints in SQL? |
|
Answer» It is a rule USED to limit the TYPE of data that can insert into a table, to MAINTAIN the integrity and accuracy of the data inside the table. It can be divided into two types.
These are the most common constraints that can be APPLIED to a table.
|
|
| 23. |
What is a Primary key? Explain |
|
Answer» A PRIMARY KEY is a column in a table that designated to UNIQUELY identifies the rows in that table. Primary key HOLDS a unique value for each row and cannot contain null VALUES. |
|
| 24. |
What is SQL and explain its components? |
|
Answer» SQL is a standard language which is used to accessing and manipulating DATABASES. It STANDS for Structured Query Language. It can be used to develop a web application for a server-side scripting language, like ASP, PHP, etc. It consists of three components that are listed below:-
In SQL, Joins is used to merge records from two or more tables in a DATABASE, BASED on a related column between them.
Here are the four types of the joins in SQL
|
|