TYBCom Computer MySQL Notes - 241111 - 123746
TYBCom Computer MySQL Notes - 241111 - 123746
6. Write a MySQL statement to create a table name BILL containing information of customers staying in
a hotel. The table must have column for :-
✓ Customer’s name (CNAME, character, variable of width 20, distinct, not empty),
✓ Customer’ address (CADDR, character, fixed width 50),
✓ Room number (ROOM, integer),
✓ Type of room (TYPE, character, width 10, not empty, which contains default entry as “NON AC”) &
✓ Days stayed (DAYS, integer, positive).
7. Write a MySQL statement to create a table named ECHARGE containing information of the customers
using electricity provided by XYZ company, having the columns
✓ Customer’s identification number (C_ID, distinct integer),
✓ Customer name (CNAME, character, variable width 20, not empty),
✓ Customer’s address (C_ADR, character, variable width 30),
✓ Type of connection (TYPE, character, of width 12, containing default entry ‘RESIDENTIAL’, should
not be empty) and
✓ Units consumed (UNITS, positive integer).
8. Write MySQL statement to create a database UNIV. In this database create a table called ADMISSION
using the following :
Column Column Name Type Length
Name of the student Sname Char 25
Gender Male Boolean
Date of birth Dob Date
Fees paid Fees Decimal 8.2
9. Write MySQL statements to create a database COLLEGE. In this database create a table LIBRARY using
the following :
Column Column Name Type Length
Name of the book Bname Char 25
Author’s Name Author Char 15
Date of purchase Pdate Date ̶
Number of pages No Integer 4
10. Write a MySQL statement to create a database PAY. In this database create a table called STOCK having
the following columns,
✓ Item number (INO, integer, Primary key),
✓ Item name (INAME, character, having variable width of 15 columns)
✓ Opening stock (OPSTK, integer, default value 0),
11. Write a MySQL statement to create a table named DEPT containing information of the employees with
the following columns,
✓ Employee Identification Number (EID, integer primary key),
✓ Employee Name (NAME, character, variable width of 15 columns),
✓ Basic Salary (BSAL with 5 integer and 2 decimal places should not be negative),
✓ DA (DA with integer and 2 decimal places),
✓ HRA (HRA with 4 integer and 2 decimal places),
✓ Total Salary (TSAL with 6 integer and 2 decimal places should not be negative) and
✓ date of birth (DOB, date).
a) Modify the table EMP change the column last_name to varchar (50).