Search for notes by fellow students, in your own course and all over the country.
Browse our notes for titles which look like what you need, you can preview any of the notes via a sample of the contents. After you're happy these are the notes you're after simply pop them into your shopping cart.
Title: Types of SQL keys
Description: Different types of SQL keys easy to learn.
Description: Different types of SQL keys easy to learn.
Document Preview
Extracts from the notes are below, to see the PDF you'll receive please use the links above
Different Types of SQL Keys
Types of SQL Keys
We have following types of keys in SQL which are used to fetch records from tables and to make relationship among tables or views
...
Super Key
Super key is a set of one or more than one keys that can be used to identify a record uniquely in a table
...
2
...
There can be multiple Candidate Keys in one table
...
Example: In below diagram ID, RollNo and EnrollNo are Candidate Keys since all these three fields can be work as Primary Key
...
Primary Key
Primary key is a set of one or more fields/columns of a table that uniquely identify a record in database table
...
Only
one Candidate Key can be Primary Key
...
Alternate key
A Alternate key is a key that can be work as a primary key
...
Example: In below diagram RollNo and EnrollNo becomes Alternate Keys when we define ID as Primary Key
...
Composite/Compound Key
Composite Key is a combination of more than one fields/columns of a table
...
6
...
It is like Primary key but it can accept only one
null value and it cannot have duplicate values
...
7
...
It can accept multiple null, duplicate values
...
Defined Keys -
1
...
CREATE TABLE Department
(
3
...
Name varchar (50) NOT NULL,
5
...
CREATE TABLE Student
7
...
ID int PRIMARY KEY,
9
...
Name varchar(50) NOT NULL,
11
...
Address varchar(200) NOT NULL,
13
...
)
Title: Types of SQL keys
Description: Different types of SQL keys easy to learn.
Description: Different types of SQL keys easy to learn.