Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
3 views

SQL Project 2

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

SQL Project 2

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Wogdi Tvet College Web Development and 2024

Database Administration

Project: 2 BASIC SQL Level-III


Create a database named COLLEGE on SQL server 2008.
Under COLLEGE, create the tables by using the following given information
Table 1: STUDENT
Field Name Type Size Default Value Constraint
Sid Varchar 10 ----- Primary Key
Name Char 30 ----- Not Null
Sex Char 6 Female Male Or Female
Section Char 10
Age Int ------- >=20
Salary Money >2000
Dname Char 40 ------- Not Null

Table 2:- COURSE


Field Name Type Size constraint
CCODE Varchar 8 Primary key
CTITLE Varchar 40 Not Null
CREDIT Int --- ------
Table 3:- GRADE REPORT
Field Name Type Size Constraint
SID Varchar 10 foreign key
CCODE Varchar 8 foreign key
GRADE Char --- A,B,C.D.F

1. show the relationship the above three table

2. Create a lookup column for the field dname can select the values(Electrical ,ICT, accounting)
they want from a list and grade report table the grade column only accept A,B,C,D and F
3. insert the sample records in to the tables as shown:
STUDENT

Sid Name Sex Section Age Salary Dname


R101 Tigist Female Room1 22 3000.00 Ict
R102 Mulu Female Room1 25 2500.00 Accounting
R103 Worku Male Room2 30 3500.00 Electrical
R104 Melkamu Male Room1 35 4000.00 Ict
R105 Seble Female Room2 21 3500.00 Electrical

COURSE GRADE_REPORT

CCode CTitle chr SId CCode Grade


Ict001 SQL 150 R101 ICT001 B
Ict002 OPC 140 R101 ICT002 C
Ict003 C++ 100 R102 ICT001 A
R103 ICT003 C
R104 ICT002 B
R104 ICT002 A
R105 ICT003 B

Set By Bamlaku Gizachew February 2016 E.C 1


Wogdi Tvet College Web Development and 2024
Database Administration

4. Develop SQL query to add the column Address with varchar(20)


5. Develop SQL query that retrieve the names of all students who score grade “B”
6. Develop SQL query that retrieve SID and Name of all female students who taken the course
title “SQL”
7. Develop SQL query that retrieve student name sex and grade whose grade is A and B
8. Write SQL statement that retrieve all students whose score grade “A” in “ICT” department
and sort them descending by their Name
9. Develop SQL statement that changes the section in to “Room4” of all students who score
grade “A” or “B” for the course title “SQL”
10. Change the name “Tigist” to “Almaz” from student table
11. Updates salary by 25% times in student table whose salary is >=3500
12. Retrieve all students the first three row
13. Display student name in upper case
14. Display student name in lower case
15. Rename the column name with Sname
16. Rename the table Student by stud
17. Rename the database college by TVET
18. Write SQL statement that create a backup for COLLEGE in local disk (D :)
19. Assume that COLLEGE ICT was dropped accidentally. Write SQL query that restore
dropped ICT from the backup.

Set By Bamlaku Gizachew February 2016 E.C 2

You might also like