--Creating Table
--Primary key and other
constraints were not defined
Create table tabTrainee(
TraineeName char(20),
Age int,
DateOfBirth date
);
1. The Above table will accept duplicate
records because it is not defined with a primary key constraint like below
insert into tabTrainee values('Syed',27,'1992/01/08')
insert into tabTrainee values('Syed',27,'1992-01-08')
--Selecting all fields with sorting
select * from tabTrainee order by TraineeName
Syed 27 1992-01-08
Syed 27 1992-01-08
2. We have not specified not null
constraints,
so the record can be inserted with empty values like below.
--Name are DateOfBirth are empty
insert into tabTrainee values('',31,'')
--Output
31 1900-01-01
Syed 27 1992-01-08
Syed 27 1992-01-08
TraineeName stored with null-value and
DateOfBirth field stored with its default value.
No comments:
Post a Comment