CST283-1 Database Management Systems Laboratory Assignment 01 MySQL Basics
Complete the following assignment during your lab class and upload the result file as instructed below. MySQL prompt will flush the output into a text file by issuing the command tee. For example, by issuing the command: mysql> tee cst06xxx.txt MySQL starts logging console text into a file named cst06xxx.txt at your home folder. To Stop sending output into a file, use the command notee
1. Execute the following simple queries and observe the output. 1. 2. 3. 4.
SHOW DATABASES; SELECT VERSION(), CURRENT_DATE; SELECT SIN(PI()/4), (4+1)*5;
SELECT USER(), NOW();
5. SELECT VERSION(); SELECT CURRENT_DATE; SELECT CURRENT_TIME; 2. Modify your queries to give custom output header names as follow, 1. VERSION()--> MYSQL_VERSION 2. CURRENT_DATE --> TODAY 3. USER --> ME 4. NOW --> TIMESTAMP 5. CURRENT_TIME --> TIME 3. Perform the following mathematical operations using MySQL (Hint 1. Find 2. Find 3. Find 4. Evaluate 4. Create database using your User Name (ex: CST06043) 1. Create a table named Student with following columns i. StudentID: Varchar(16) ii. FirstName:Varchar(32) iii. LastName:Varchar(48) iv. NIC:Char(10) and )
v. Address:Varchar(128) vi. DateOfBirth: Date 2. Populate 10 records using INSERT INTO statement to the above created table. 3. Retrieve the StudentID, FirstName and LastName of the entered records using SELECT statement.