Professional Documents
Culture Documents
Majors(majorID, majorName)
1/ Logical database design: use Draw.io tool to create ERD (Entity relationship
diagram).
Table: Majors
Column name
Data type Allow nulls Description
(Field name)
mID nchar(10) PK
mName varchar(50) Fk
Column name
Data type Allow nulls Description
(Field name)
studentID nchar(10) PK
FirstName nvarchar(100) FK
LastName nvarchar(100) FK
Age int FK
majorID nchar FK
use StudentDB1;
4/ Database diagram:
select S.studentID,S.FirstName,S.LastName,S.Age,M.majorName
from Students S, Majors M
where S.majorID = M.majorID;
select S.studentID,S.FirstName,S.LastName,S.Age,M.majorName
from Students S, Majors M
where S.majorID = M.majorID and S.majorID = 'IT'
10/ Same as question 9 but only show majors with Quantity > 3
select M.majorName, count(S.studentID) as Quantity
from Students S, Majors M
where S.majorID = M.majorID
group by M.majorName
having count(S.studentID) > 3;