SQL Interview Questions and Answers for Freshers, Experienced | Database - Page 3
15. What is a SQL Composite Primary Key
A Composite primary key is a set of columns whose values uniquely identify every row in a table. For example , in the table given above , if "Employee_ID" and "Employee Name" together uniquely identifies a row its called a Composite Primary Key . In this case , both the columns will be represented as primary key .
16. What is a Composite Primary Key ?
A Composite primary key is a set of columns whose values uniquely identify every row in a table. For example , in the table given above , if "Employee_ID" and "Employee Name" together uniquely identifies a row its called a Composite Primary Key . In this case , both the columns will be represented as primary key .
17. What is a Foreign Key ?
Frequently asked SQL Interview Questions
When a "one" table's primary key field is added to a related "many" table in order to create the common field which relates the two tables, it is called a foreign key in the "many" table. In the example given below , salary of an employee is stored in salary table . Relation is established via foreign key column “Employee_ID_Ref” which refers “Employee_ID” field in Employee table .
18. What is a Unique Key ?
Unique key is same as primary with difference being existence of null . Unique key field allows one value as NULL value
SQL Interview Questions and answers on SQL Commands
19. Define SQL Insert Statement?
Frequently asked SQL Interview Questions
SQL INSERT statement is used to add rows to a table. For a full row insert , SQL Query should start with “insert into “ statement followed by table name and values command followed by the values that need to be inserted into the table .Insert can be used in several ways:
1. To insert a single complete row
2. To insert a single partial row
20. Define SQL Update Statement?
Frequently asked SQL Interview Questions
SQL Update is used to update data in a row or set of rows specified in the filter condition .
The basic format of an SQL UPDATE statement is ,Update command followed by table to be updated and SET command followed by column names and their new values followed by filter condition that determines which rows should be updated
21. Define SQL Delete Statement?
SQL Delete is used to delete a row or set of rows specified in the filter condition .The basic format of an SQL DELETE statement is ,DELETE FROM command followed by table name followed by filter condition that determines which rows should be updated