Page 156 - Informatics_Practices_Fliipbook_Class12
P. 156
Pin_ Dept_
ID FName LName Gender Address City DOB Salary
Code No
E0001 Raj Reddy M West Godavari Andhra 534197 1980-06-13 100000 2
Pradesh
E0002 Dhiraj Bora M Dispur, Kamrup, Guwahati 781005 1975-09-30 85000 1
Assam
E0003 Muskan Taneja F 8/33, Geeta Delhi 110031 1990-01-25 100000 2
Colony
E0004 Hiten Oberoi M 15, Dimna Road, Jamshedpur 831018 1985-06-24 100000 4
Mango
E0005 Anshul Verma M House 10, Noida 201304 1990-01-01 100000 1
Sector 16,
Gautam Budh
Nagar
E0006 Rajit Gadh F 12, Beldih Jamshedpur 831001 1960-05-07 60000 4
Triangle,
Bistupur
E0008 Naval Dhingra M E-14 Vivek Vihar Delhi 110095 1975-08-04 70000 2
E0009 Naveen Basra F 28, Aambagan Jamshedpur 831001 1980-09-24 60000 4
Road, Sakechi
E0010 Savita Ambedkar F C-49, G-Block, Mumbai 400051 1987-07-11 50000 5
Bandra Kurla,
Bandra East
Table 11.6: Result of DELETE statement on EMPLOYEE table
The execution of the following statement will delete all rows of the table EMPLOYEE.:
DELETE FROM EMPLOYEE;
However, the table EMPLOYEE remains part of the database and can be populated again.
DROP TABLE Statement
The DROP TABLE statement deletes an existing table in a database. For example, to drop the table EMPLOYEE from
the database Company, we can use the following SQL statement:
DROP TABLE EMPLOYEE;
ALTER TABLE statement
ALTER TABLE statement allows us to add, change, and delete attributes of a table. It can also be used to create and
remove SQL constraints from tables.
Add Attributes
To add attributes to an existing table; we use the ALTER TABLE statement with the ADD keyword. The syntax of the
ALTER TABLE ADD statement is as follows:
ALTER TABLE table_name ADD attribute data_type [constraint] ;
For example, to add a new attribute Phone in the EMPLOYEE table, the SQL statement is as follows:
ALTER TABLE EMPLOYEE ADD Phone DECIMAL(10,0);
On executing the above statement, Phone attribute of the tuples that already exist in the EMPLOYEE table will be
assigned NULL value (see Table 11.6a)
142 Touchpad Informatics Practices-XII

