Professional Documents
Culture Documents
Ex.1 Product (Id Integer, Brand Varchar (30), Model - Number Varchar (20), Price Integer)
Ex.1 Product (Id Integer, Brand Varchar (30), Model - Number Varchar (20), Price Integer)
1
1. Create a table ‘Product’ with attributes and data type respectively.
Product (Id integer, Brand varchar(30), Model_Number varchar(20), Price integer);
2. Insert data into ‘Product’ table. The legal values for Brand must be as follow: (‘Samsung’, ‘Huawei’,
‘Vivo’, ‘Oppo’). Any other insertion into Brand is not allowed except these legal values.
2 Samsung A3 350000
3 Huawei P8 350000
3. Create another table ‘Product_Info’ with field names and data types respectively.
Product_Info (Model_Number varchar(20), Old_Price integer, New_Price integer);
4. Create trigger, ‘Product_Trigger’, on table ‘Product’. This trigger fired automatically AFTER
UPDATE operation is performed on table ‘Product’. Furthermore, the update record is inserted into
table ‘Product_Info’.
5. Change the price of Grand2 to 200000.
6. Get query to view Product_Info table.
7. Drop the trigger, ‘Product_Trigger’.
*************************
Ex.2
C4 Javascript Application
3. Create another table ‘Course_Info’ with field names and data types respectively.
Course_Info (Cid varchar(5), Old_Course_Name varchar(30), New_Course_Name varchar(30));
4. Create trigger, ‘Course_Trigger’, on table ‘Course’. This trigger fired automatically AFTER
UPDATE operation is performed on table ‘Course’. Furthermore, the update record is inserted into
table ‘Course_Info’.
5. Change the course name of C1 from Computer Fundamental to Data Structure.
6. Get query to view Course_Info table.
7. Drop the trigger, ‘Course_Trigger’.