Ch-13 Creating Tables and DML Commands
Ch-13 Creating Tables and DML Commands
mysql> INSERT INTO Student ( StID, FName, Name, You can also define order of
Class) VALUES ( ‘ s3’ , ’ Ami tab h ’ , columns.
’Abhishek’, 10);
Inserting Records from Other Table
You can insert all or selected record(s) in the table from another table by using Select … command in place of Values.
Suppose a table named NEWSTUDENT has been created and records to be inserted from OLDSTUDENT table having
the same structure of columns.
What is a constraint?
Column Level
Constraints
Not Null
Table Constraint
Level Constraints
Unique Key Constraint
Default Constraint
Check Constraint
Primary Key Constraint
Foreign Key Constraint
Defining Constraint in Alter Table Command
What is a Constraint?
Integrity Constraints are the rules which are applied on the table or
column to maintain integrity.
Besides the cell name, cell length and the cell data type, there are other
parameters that is other da ta c onstraints that can be passed to the DBA at
TABLE creation time.
by the DBA, the DBA will not load the data into the cell, reject the entered
record and will flash an error message.
The constraints can either be placed at the column level or at the table level.
Column Level Constraint- These constraints are defined along with the colu mn
definition. These constraints can be applied to any one column at a time. If
the constraints spans across multiple columns ,then the table level
constraints are used.