Page 157 - Informatics_Practices_Fliipbook_Class12
P. 157
Pin_ Dept_
ID FName LName Gender Address City DOB Salary Phone
Code No
E0001 Raj Reddy M West Godavari Andhra 534197 1980-06-13 100000 2 NULL
Pradesh
E0002 Dhiraj Bora M Dispur, Guwahati 781005 1975-09-30 85000 1 NULL
Kamrup, Assam
E0003 Muskan Taneja F 8/33, Geeta Delhi 110031 1990-01-25 100000 2 NULL
Colony
E0004 Hiten Oberoi M 15, Dimna Jamshedpur 831018 1985-06-24 100000 4 NULL
Road, Mango
E0005 Anshul Verma M House 10, Noida 201304 1990-01-01 100000 1 NULL
Sector 16,
Gautam Budh
Nagar
E0006 Rajit Gadh F 12, Beldih Jamshedpur 831001 1960-05-07 60000 4 NULL
Triangle,
Bistupur
E0007 Taran Adarsh M B-76, CST Mumbai 400098 1965-01-13 70000 5 NULL
Road, Kalina,
Santacruz East
E0008 Naval Dhingra M E-14 Vivek Delhi 110095 1975-08-04 70000 2 NULL
Vihar
E0009 Naveen Basra F 28, Aambagan Jamshedpur 831001 1980-09-24 60000 4 NULL
Road, Sakechi
E0010 Savita Ambedkar F C-49, G-Block, Mumbai 400051 1987-07-11 50000 5 NULL
Bandra Kurla,
Bandra East
Table 11.6a: Phone attribute is assigned value NULL
To enforce NOT NULL constraint on the attribute Phone, we will use the following statement instead of the above
ALTER statement:
ALTER TABLE EMPLOYEE ADD Phone DECIMAL(10,0) NOT NULL;
On executing the above statement, Phone attribute of the tuples that already exist in the EMPLOYEE table will be
assigned value 0 as we have not specified a default value of the Phone attribute (see Table 11.6b)
Pin_ Dept_
ID FName LName Gender Address City DOB Salary Phone
Code No
E0001 Raj Reddy M West Godavari Andhra 534197 1980-06-13 100000 2 0
Pradesh
E0002 Dhiraj Bora M Dispur, Kamrup, Guwahati 781005 1975-09-30 85000 1 0
Assam
E0003 Muskan Taneja F 8/33, Geeta Delhi 110031 1990-01-25 100000 2 0
Colony
E0004 Hiten Oberoi M 15, Dimna Road, Jamshedpur 831018 1985-06-24 100000 4 0
Mango
E0005 Anshul Verma M House 10, Sector Noida 201304 1990-01-01 100000 1 0
16, Gautum Budh
Nagar
E0006 Rajit Gadh F 12, Beldih Jamshedpur 831001 1960-05-07 60000 4 0
Triangle, Bistupur
Database Query using SQL 143

