MCQs Test!! VB Basic Test !! Essentials of VB !! Creating User Services !! function !! Anatomy !! GK March-2019 !! DATA TYPES IN JAVA !! Classes ,Constructor ,Methods,Inheritance !! Ecology-I !! Biology 2019 !! Gk april 2019 !! Biology (living world) !! Plant anatomy !! CELL STRUCTURES AND FUNCTION !! General biology !! Human physiology !! Data structure !! Ecology-II !! GK TEST !! Reproduction in plants !! Human reproduction !! The ABC of C !! Operating system set1 !! Operating system set2 !! Gk and current affairs !! Animal kingdom !! Number system !! Animal kingdom-II !! Gk TEST-III !! Number series !! Microorganisms !! Interview question in c !! Time and Work !! Percentage !! General history !! Average !! Cells !! Locomotion and Movement !! paging !! Bacteriology !! Page replacement policy !! Secondary memory and Disk scheduling !! Introduction of Nervous System and neurons !! Plant harmones !! Transport and Mineral Nutrition in Plants !! Neurotransmitters !! Modern Indian History !! Photosynthesis in Plants !! Modern Indian History-II !! Plant respiration !! Environment & Biodiversity !! Environment & Biodiversity - II !! Algae, Bryophytes, Pteridophytes !! Area !! Cricket !! Days of the Year (India and the World) !! Plant Pathology - I !! Indian Transport System !! Plant Pathology - II !! Aptitude !! Biology !! Botany !! C language !! Computer Science !! Core Java !! Gate !! GK !! Mysql !! Operating system !! Physics !! VB-Visual Basic !! Zoology


keys in MySQL
Previous Home Next

There are few keys define in the MySQL, they are:

  1. Primary key
  2. Foreign key
  3. Compound key

Primary key

It is a uniquely identified key in each records in the defined database. It does not contain "Null" values. Almost all table contains the primary key. The creation of primary key should be define while we are creating table into the database, else we need to alter the table as per our definition requirements.


columnname datatype(size) NOT NULL PRIMARY KEY


 create table studper(pid int(3) not null primary key auto_increment,
 sid int references studinfo(sid),
 fathername varchar(20), 
 mothername varchar(20));

In the above code we have define the 'pid' as a Primary key which is 'not null' and can be 'auto_increment' its value.

Foreign key

As the name define foreign, its foreign to the other table, means if a primary key is present or declare in the different table and it can be used in different table as a column so its declare as a foreign key in the used table.



columnname datatype references tablename(columnname or Primaykeyname)

In the above code we have define "sid" as a foreign key in the current table(studper) and tablename is studinfo is the references table in which reference column name is sid.

Compound key

It is a key that consists of multiple columns, because one column is not sufficiently unique in the define table. It also called composite key.

Levels Of Abstraction

It is the process of representing the essential features. there are three forms of schemas or level define they are:

  1. Physical
  2. Conceptual
  3. External

Physical level

In this level of schema it describes details of how data is stored: files, indices, etc. on the other access disk system. It also describes the record layout of files and type of files structure we are using like hash, b-tree,etc. It describe the low level of abstraction structure in detail.

Conceptual level

In this level of schema, it describes what type data are stored in the database, and what relationships exist among those data. It is also refered as the logical level.

External level

In this level of schema it presents data as a set of relations. It specifies a view of the data in terms of the conceptual level. it also referred as the view level.

Previous Home Next