database keys ad schema

Database keys(primary,foreign,super,candidate,index) and database schema

BCA Notes Blogs

Keys in Database

A key is a field or column value in a table. It is used to identify a record in a table which is unique and it is used to establish a relationship with other table in a database.

Types of Keys in Database:

Primary Key

  1. It is a special key which is must be unique
  2. Value must not be repeated/not redundant
  3. Value should not be null
fig: Primary key

Foreign key

  1. Foreign key is the field which matches with the primary key field to establish a relation among that table.
  2. Derived from primary key
fig: Foreign key

Super Key

  1. Super key is a set of one or more attributes that taken collectively allows us to identify each record uniquely.
  2. Super key [id, password no, LN, CN]
Fig: Super key

Candidate Key

  1. A combination of one or more fields whose value uniquely identifies a record in a table.
  2. A candidate key is a subset of a super key
  3. Eg. StudentId is a primary key ad in same table CourseId is candidate key
fig: Candidate key

Index key: The index key speeds up of searching and storing operation.

fig: index key

Meta data

 The Data inside data is called meta data. It summarized the additional information of data.

Schema

  1. The overall design of the database is called schema.
  2. The blue print of the database is called schema
  3. The structure of the database is called schema
  4. Total design of the database is called schema

SQL (Structured Query Language):

  1. SQL is used for communication between user and RDBMS. It extracting information from a database by using given criteria or requesting for data.
  2. SQL is a high level language.
  3. It is a non procedural language.
  4. It is a fourth generation language
  5. It can run any computer so it is portable.
  6. SQL retrieve, insert, delete, update, create data in database.
  7. It can set permission on a table.

Leave a Reply

Your email address will not be published. Required fields are marked *