SQL Tricky Interview Questions

Avatto > > DATA SCIENTIST > > SHORT QUESTIONS > > SQL Tricky Interview Questions

It is used to define the database structure such as tables. It includes 3 commands:-
a. Create – Create is for creating tables to CREATE TABLE table_name ( column1 data type, column2 data type, column3 datatype,....
);
b. Alter – Alter table is used to modifying the existing existing table object in the database. ALTER TABLE table_name
ADD column_name datatype
c. Drop – If you drop a table, all the rows in the table are deleted and the table structure is removed from the database. Once the table is dropped, you can’t get it back
Data Manipulation Language is used to manipulate the data in records. Commonly used DML commands are Update, Insert and Delete. Sometimes SELECT command is also referred as a Data Manipulation Language.
Data Control Language is used to control the privileges by granting and revoking database access permission
a. AVG()
b. COUNT()
c. MAX()
d. MIN()
e. SUM()
Normalization is used to organize the data in such a manner that data redundancy will never occur in the database and avoid insert, update, and delete anomalies.
There are 5 forms of Normalization
First Normal Form (1NF): It removes all duplicate columns from the table. Creates a table for related data and identifies unique column values
Second Normal Form (2NF): Follows 1NF and creates and places data subsets in an individual table and defines the relationship between tables using a primary key
Third Normal Form (3NF): Follows 2NF and removes those columns which are not related through primary key
Fourth Normal Form (4NF): Follows 3NF and does not define multi-valued dependencies. 4NF also known as BCNF