Enter your keyword

KEYS

Definition


According to the SQL Standard, a key is a subset of columns in a table that allow a row to be uniquely identified. So, a key can be more than just one column. And, every row in the table will have a unique value for the key – or a unique combination of values if the key consists of more than just one column.

Example

Consider the structure of the two tables as follows:

CUSTOMERS table:

CREATE TABLE CUSTOMERS(
ID INT NOT NULL,
NAME VARCHAR (20) NOT NULL,
AGE INT NOT NULL,
ADDRESS CHAR (25) ,
SALARY DECIMAL (18, 2),
PRIMARY KEY (ID)
);
ORDERS table:

CREATE TABLE ORDERS (
ID INT NOT NULL,
DATE DATETIME,
CUSTOMER_ID INT references CUSTOMERS(ID),
AMOUNT double,
PRIMARY KEY (ID)
);

Commonly asked interview questions on Constructors

1.What is the difference between SQL and MySQL or SQL Server?

Answer :SQL or Structured Query Language is a language; language that communicates with a relational database thus providing ways of manipulating and creating databases. MySQL and Microsoft’s SQL Server both are relational database management systems that use SQL as their standard relational database language.

What is th

2.What is the difference between SQL and PL/SQL?

Answer :PL/SQL is a dialect of SQL that adds procedural features of programming languages in SQL. It was developed by Oracle Corporation in the early 90’s to enhance the capabilities of SQL.

3.What are the specific uses of SQL functions?

Answer :SQL functions have the following uses −

Performing calculations on data

Modifying individual data items

Manipulating the output

Formatting dates and numbers

Converting data types

4.What are the case manipulation functions of SQL?

Answer :
LOWER, UPPER, INITCAP

5. What are the different type of SQL’s statements ?

Answer :
This is one of the most frequently asked SQL Interview Questions for freshers. SQL statements are broadly classified into three. They are
1. DDL – Data Definition Language
2. DML– Data Manipulation Language
3. DCL– Data Control Language

Take Sample Test

Reference Books


1. Head First Java

No Comments

Add your review

Your email address will not be published.