write 8 SQL queries to get usuful information from the following student databas
ID: 3829598 • Letter: W
Question
write 8 SQL queries to get usuful information from the following student database. Please explain your query and be clear. I will upvote clear answer. Thanks
create table student( student_num varchar2(10) PRIMARY KEY, Fname varchar2(20), Lname varchar2(20),
age decimal(5,2), GPA REAL, CHECK (GPA>=0.00), CHECK (GPA<=4.00), gender varchar2(10),
major varchar2(30), year varchar2(20));
create table address( s_number varchar2(10) references student(student_num), street varchar2(20),
city varchar2(20), state varchar2(20), zipcode number(10), country varchar2(20));
create table instructor ( I_id varchar2(10) PRIMARY KEY, name varchar2(20),
dept varchar2(20));
create table section( SectionNumber varchar2(10) PRIMARY KEY, term varchar2(10), year number(10),
location varchar2(20), s_id varchar2(10) references student(student_num),
instructor_id varchar2(10) references instructor(I_id));
create table course( course_num varchar2(10) PRIMARY KEY, name varchar2(20),
creditHours number(5), section_id varchar2(10) references section(SectionNumber));
Explanation / Answer
Select Fname,Lname ,GPA,Major from Student where GPA >=3;
It will display the records of all students with their first name,last name,GPA and Major whose GPA is greater than or equal to 3.
Select Fname,Lname ,Street,City,State from Student inner join Address on student.student_num = address.s_number) where GPA >=3;
It will display the records of all students with their first name,last name,street,city and state whose GPA is greater than or equal to 3.
Select Fname,Lname,SectionNumber from student inner join section on student.student_num = section.SectionNumber;
display the first name,last name and section of the student
Select name,dept from instructor;
display the name of the instructor and his or her department.
Select name,section_id from course;
display the name of the course and section number.
Select Fname,Lname from student where GPA = (Select(max(GPA) from student);
display the name of student with highest GPA
Select avg(GPA) from student;
display the average GPA of all students.
Select * from address where upper(country) = 'CANADA';
display all students whose country is CANADA.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.