SQL INTERVIEW QUESTION CHEATSHEET.
SQL is the most popular database and many popular websites use SQL. So, here is a collection of the most asked #SQL interview questions to help you prepare.
Please share with your friends and bookmark for easy recall.
1. What is Database?
2. A database is an organized collection of data, stored and retrieved digitally from a remote or local computer system. Databases can be vast and complex, and such databases are developed using fixed design and modeling approaches.
1. What is Database?
2. A database is an organized collection of data, stored and retrieved digitally from a remote or local computer system. Databases can be vast and complex, and such databases are developed using fixed design and modeling approaches.
3. What is SQL?
SQL stands for Structured Query Language. It is the standard language for relational database management systems. It is especially useful in handling organized data comprised of entities and relations between different entities of the data.
4. What is the difference between SQL and MySQL?
SQL is a standard language for retrieving and manipulating structured databases. On the contrary, MySQL is a relational database management system, like #SQL Server, Oracle , that is used to manage SQL databases.
5. What are Tables and Fields?
A table is an organized collection of data stored in the form of rows and columns. Columns can be categorized as vertical and rows as horizontal. The columns in a table are called fields while the rows can be referred to as records
6. What is a Primary Key?
The PRIMARY KEY constraint uniquely identifies each row in a table. It must contain UNIQUE values and has an implicit NOT NULL constraint.
A table in SQL is strictly restricted to have one and only one primary key.
7. What is a UNIQUE constraint?
A UNIQUE constraint ensures that all values in a column are different. This provides uniqueness for the column(s) and helps identify each row uniquely. Unlike the primary key, there can be multiple unique constraints defined per table.
8. What is a Foreign Key?
A FOREIGN KEY comprises of single or collection of fields in a table that essentially refers to the PRIMARY KEY in another table. Foreign key constraint ensures referential integrity in the relation between two tables.
9. What is a Join? List its different types.
The SQL Join clause is used to combine records (rows) from two or more tables in a SQL database based on a related column between the two.
Types -
INNER JOIN
LEFT OUTER JOIN
RIGHT OUTER JOIN
FULL OUTER JOIN
10. What is a Query?
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.
11. SQL create and drop database?
Create database db_name -
=> CREATE DATABASE db_name;
Drop database db_name -
=> DROP DATABASE db_name;
12. Create and drop a table in SQL?
CREATE TABLE table_name (
column1 datatype,
column2 datatype,
column3 datatype,
....
);
DROP TABLE table_name;
13. What is the difference between DROP and TRUNCATE statements?
If a table is dropped, all things associated with the tables are dropped as well. However, if a table is truncated, none of the above problems exist and the table retains its original structure.
14. How do we use the DISTINCT statement?
The DISTINCT statement is used with the SELECT statement. If a record contains duplicate values then DISTINCT will select different values among duplicate records.
Syntax-
SELECT DISTINCT column_name
FROM table_name;
15. What is ACID property?
In order to maintain consistency in a database, before and after the transaction, certain properties are followed. These are called ACID properties.
- Atomicity
- - Consistency
- Isolation
- - Durability
16. How many Aggregate functions are available in SQL?
SQL Aggregate functions calculate values from multiple columns and return a single value. There are 7 aggregate functions in SQL:
1. AVG()
2. COUNT()
3. MAX()
4. MIN()
5. SUM()
6.
SQL is the most popular database and many popular websites use SQL. So, here is a collection of the most asked #SQL interview questions to help you prepare.
Please share with your friends and bookmark for easy recall.
1. What is Database?
2. A database is an organized collection of data, stored and retrieved digitally from a remote or local computer system. Databases can be vast and complex, and such databases are developed using fixed design and modeling approaches.
1. What is Database?
2. A database is an organized collection of data, stored and retrieved digitally from a remote or local computer system. Databases can be vast and complex, and such databases are developed using fixed design and modeling approaches.
3. What is SQL?
SQL stands for Structured Query Language. It is the standard language for relational database management systems. It is especially useful in handling organized data comprised of entities and relations between different entities of the data.
4. What is the difference between SQL and MySQL?
SQL is a standard language for retrieving and manipulating structured databases. On the contrary, MySQL is a relational database management system, like #SQL Server, Oracle , that is used to manage SQL databases.
5. What are Tables and Fields?
A table is an organized collection of data stored in the form of rows and columns. Columns can be categorized as vertical and rows as horizontal. The columns in a table are called fields while the rows can be referred to as records
6. What is a Primary Key?
The PRIMARY KEY constraint uniquely identifies each row in a table. It must contain UNIQUE values and has an implicit NOT NULL constraint.
A table in SQL is strictly restricted to have one and only one primary key.
7. What is a UNIQUE constraint?
A UNIQUE constraint ensures that all values in a column are different. This provides uniqueness for the column(s) and helps identify each row uniquely. Unlike the primary key, there can be multiple unique constraints defined per table.
8. What is a Foreign Key?
A FOREIGN KEY comprises of single or collection of fields in a table that essentially refers to the PRIMARY KEY in another table. Foreign key constraint ensures referential integrity in the relation between two tables.
9. What is a Join? List its different types.
The SQL Join clause is used to combine records (rows) from two or more tables in a SQL database based on a related column between the two.
Types -
INNER JOIN
LEFT OUTER JOIN
RIGHT OUTER JOIN
FULL OUTER JOIN
10. What is a Query?
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.
11. SQL create and drop database?
Create database db_name -
=> CREATE DATABASE db_name;
Drop database db_name -
=> DROP DATABASE db_name;
12. Create and drop a table in SQL?
CREATE TABLE table_name (
column1 datatype,
column2 datatype,
column3 datatype,
....
);
DROP TABLE table_name;
13. What is the difference between DROP and TRUNCATE statements?
If a table is dropped, all things associated with the tables are dropped as well. However, if a table is truncated, none of the above problems exist and the table retains its original structure.
14. How do we use the DISTINCT statement?
The DISTINCT statement is used with the SELECT statement. If a record contains duplicate values then DISTINCT will select different values among duplicate records.
Syntax-
SELECT DISTINCT column_name
FROM table_name;
15. What is ACID property?
In order to maintain consistency in a database, before and after the transaction, certain properties are followed. These are called ACID properties.
- Atomicity
- - Consistency
- Isolation
- - Durability
16. How many Aggregate functions are available in SQL?
SQL Aggregate functions calculate values from multiple columns and return a single value. There are 7 aggregate functions in SQL:
1. AVG()
2. COUNT()
3. MAX()
4. MIN()
5. SUM()
6.