DBMS QUIZ 1 LAB

07Aug10

DBMS LAB

Quiz 1 (IM201L lab)

Stud No

Lname

Fname

Middle

Course

Tuition

123456

Ambrocio

Ria

A.

BCDPM

750

234567

Austria

Elias

A.

BSIT

30000

345678

Reyes

Shalaine

H.

BSCS

23000

456789

Nayre

Rachele

A.

BSN

45000

567890

Morales

Mario

R.

BSHRM

56789

678901

Pagalilawan

Alfred

B.

BLIS

23940

789012

Andres

Florante

D.

BSIT

34500

890123

Luna

Anton

S.

BA

45678

Fill in the table:

Question

Command

1. Create a Database named ENROLL

create database ENROLL;

2. Open the created database

Use ENROLL;

3. Create a table named STUDENT. Use

the table to design the structure of the

table.

create table STUDENT (StudNo text(6), Lname text(15), Fname text(15), Middle varchar(1), Course text(5), Tuition int(5));

4. Insert the first two values in the table

insert into STUDENT values

5. Assuming you have typed the values in a file called student.txt in drive C, load the file in the table STUDENT.

load data local infile ‘C:/students.txt’ into table STUDENT;

6. Display the structure of your table.

describe STUDENT;

7. Display the records in your table displaying only the student no., last name, firstname, and course.

select StudNo, Lname, Fname, Course from STUDENT;

8. Display the student number , lastname of the student whose tuition is more than 50000.

select StudNo, Lname from STUDENT where Tuition>’50000′;

9: Display the student number, and lastname of the student

select StudNo from STUDENT order by LNAME;

10. Compute for the new tuition fee of the students. Name the new column as new_tuition.

select tuition*1.something as new_tuition

11. Display all the records of students whose firstname starts with letter S.

 

12. Display all records of students whose course is BSIT and Fname is Elias

select * from STUDENT where course = ‘BSIT’ && name = "Elias";

13. Display all records of students whose name starts with S and three characters after S.

select * from STUDENT where

14. Display all records of students sorted by tuition in descending order.

select * from STUDENT order by tuition desc;

15. Display all records of students whose tuition fee is more than 6000 and lastname starts with A or B.

 
Advertisement


Follow

Get every new post delivered to your Inbox.