1) What is SQL?
Structured Query Language is a language used for creating and accessing the database. It is an ANSI (American National Standards Institute) standard.
2) What are the tables in SQL?
The table is a collection of rows and column. It shows a group of records at a single view.
3) List some Aggregate functions of SQL?
In SQL, there are basically seven aggregate functions.
AVG(): It gives the average value from specific columns.
COUNT(): This function returns the number of rows present in the table.
MAX(): It gives the biggest value present in the records.
MIN(): The function returns the largest value present in the records.
4) What is schema?
A schema is a group of database objects of any users.
5) What are the different types of SQL commands?
The SQL commands are divided into five types.
- DML – Data Manipulation Language
- DQL – Data Query Language
- DDL – Data Definition Language
- TCL – Transaction Control Language
- DCL – Data Control Language
6) What is a temp table?
A temp table is a temporary storage structure for storing data on a temporary basis.
7) What is a primary key?
A primary key is a group of a field that uniquely identifies a row. Each table must have a primary key and it must be unique. The value of the primary key cannot be NULL.
8) What is a unique key?
A Unique key defines each record uniquely in the database. This key gives distinctiveness for set of columns and set of columns.
10) How to remove duplicate rows in a query?
To avoid duplicate rows in a query, DISTINCT is used to unique values. It removes all the duplicate SQL SELECT DISTINCT query is used to return only unique values. It eliminates all the duplicate values.
11) What is a trigger?
A database trigger is a program or code that executes automatically in response to the event on a view or table in a database. It assists in maintaining the integrity of the database.
12) What is a stored procedure?
Stored Procedure is a function that has SQL statement to access the database system. The SQL statements are combined into a stored procedure so that you can execute it whenever you want to execute.
13) What is a View?
A view is a virtual table is a subset of data present in the table. These tables are not present virtually and need very small space for storage. It can have the combined data of one or more tables as per the relationship.
14) What is an Index?
An index is basically a performance tuning process that allows the fast retrieval of records from any table. Different types of indexes are present in the database.
- Clustered Index
- Non-Clustered Index
- Unique Index
15) What is JOIN?
JOIN is used to merge rows from two or more tables on the basis of the related column between them. Different types of JOIN present in SQL are given below:
- Left Join
- Right Join
- Inner Join
- Full Join