Question

rider_student Column Data Type Description student_id integer the primary key first_name varchar(25) student first name last_name...

rider_student

Column Data Type Description
student_id integer the primary key
first_name varchar(25) student first name
last_name varchar(25) student last name
major_id integer the ID of the student's major; a foreign key for the major_id in the rider_major table

rider_major

Column Data Type Description
major_id integer the primary key
major_name varchar(50) student first name
major_description varchar(100) student last name

Use the Tables above to answer the questions.

Questions:
1. Write a SQL statement to add a student record to the rider_student table for you. This should be a student with your name. Add data to all table columns. Examine the records in the rider_major table and use a major currently in the table.


2. Write a SQL statement to add a major record for a major not currently listed in the rider_major table. Add data to all table columns. Be creative and assume you can create a major for anything of interest to you. You must a major that does not currently exist to the table.


3. Assume you want to change your major to the major you added in the previous question. Write a SQL statement to change the major.


4. Write a SQL statement to retrieve the student first_name, last_name, major_name, and major_description for all records in the rider_student table. This will require an appropriate join between therider_student and rider_major tables.


5. Write a SQL statement to retrieve the student first_name, last_name, major_name, and major_description for the rider_student record you added for yourself. This will require an appropriate join between therider_student and rider_major tables.

6. Add an additional record to the rider_student table (see question 1 above). Use any name. Then write a delete statement to delete that record. Note: you are deleting only one record and you need to write your delete statement correctly to do that.

0 0
Add a comment Improve this question Transcribed image text
Answer #1
  1. INSERT INTO rider_student VALUES (<student id,student first name,student last name>);
  2. INSERT INTO rider_major VALUES (<student course>);
  3. UPDATE rider_student SET major_id = <studnt id> WHERE student_id = <student id>;
  4. SELECT first_name, last_name, major_name, major_description FROM rider_student LEFT JOIN rider_major on rider_student.major_id = rider_major.major_id;
  5. SELECT first_name, last_name, major_name, major_description FROM rider_student LEFT JOIN rider_major on rider_student.major_id = rider_major.major_id WHERE student_id = <your student_id>;
Add a comment
Know the answer?
Add Answer to:
rider_student Column Data Type Description student_id integer the primary key first_name varchar(25) student first name last_name...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Lesson 10Create the DEPARTMENT tables based on the following: Column Name   ID      Name Data Type     Number...

    Lesson 10Create the DEPARTMENT tables based on the following: Column Name   ID      Name Data Type     Number Varchar2 Length        7      25 Populate the DEPARTMENT table with data from the DEPT table. Include only columns that you need. Create the EMPLOYEE table based on the following table chart: Column Name    ID      LAST_NAME     FIRST_NAME     DEPT_ID Data Type      Number Varchar2      Varchar2       Number Length         7       25            25             7 Modify the EMPLOYEE table to allow for longer employee last names. Confirm your modification. Confirm that both the...

  • create table candidate ( cand_id   varchar(12) primary key,   -- cand_id name       varchar(40)           --...

    create table candidate ( cand_id   varchar(12) primary key,   -- cand_id name       varchar(40)           -- cand_nm ); create table contributor ( contbr_id   integer primary key, name       varchar(40),           -- contbr_nm city     varchar(40),           -- contbr_city state       varchar(40),           -- contbr_st zip       varchar(20),           -- contbr_zip employer   varchar(60),           -- contbr_employer occupation   varchar(40)           -- contbr_occupation ); create table contribution ( contb_id   integer primary key, cand_id   varchar(12),           --...

  • CREATE TABLE Gender ( gender CHAR(1), description VARCHAR(10), PRIMARY KEY (gender) ); CREATE TABLE People (...

    CREATE TABLE Gender ( gender CHAR(1), description VARCHAR(10), PRIMARY KEY (gender) ); CREATE TABLE People ( ID INT, name VARCHAR(50), gender CHAR(1), height FLOAT, PRIMARY KEY (ID), FOREIGN KEY (gender) REFERENCES Gender (gender) ); CREATE TABLE Sports ( ID INT, name VARCHAR(50), record FLOAT, PRIMARY KEY (ID), UNIQUE (name) ); CREATE TABLE Competitions ( ID INT, place VARCHAR(50), held DATE, PRIMARY KEY (ID) ); CREATE TABLE Results ( peopleID INT NOT NULL, competitionID INT NOT NULL, sportID INT NOT NULL,...

  • This is a database with two tables relating to students at a school. Each student has...

    This is a database with two tables relating to students at a school. Each student has a unique ID. There is a backlog table that maintains a record of active backlogs for each student. Write a query my oracle sql to print the names of the students who have at least one active backlog. The names should be printed in ascending order.The results should be in the following format: NAME Note: There could be students with the same name but...

  • CREATE TABLE Users (               userId varchar (30) NOT NULL,               pass varchar (30),     

    CREATE TABLE Users (               userId varchar (30) NOT NULL,               pass varchar (30),               fname varchar (50),               lname varchar (50),               email varchar (50),               gender char(1),               age integer,               banned boolean,               PRIMARY KEY (userId),               UNIQUE(email)) CREATE TABLE FavSellers (               userId varchar (30),               sellerId varchar (30),               PRIMARY KEY (userId, sellerId),               FOREIGN KEY(userId) references Users,               FOREIGN KEY(sellerId) references Users(userId)) CREATE TABLE Items (               itemId integer,               title varchar (50),              ...

  • CREATE TABLE actor( id INTEGER NOT NULL, name VARCHAR(100), PRIMARY KEY (id) ); SELECT name FROM...

    CREATE TABLE actor( id INTEGER NOT NULL, name VARCHAR(100), PRIMARY KEY (id) ); SELECT name FROM actor WHERE name LIKE 'M%'; Q. How to run explain plan on the above query and display its output?

  • Assume the following employees.sql file: create table employees (    id INTEGER NOT NULL PRIMARY KEY...

    Assume the following employees.sql file: create table employees (    id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT NOT NULL,    first_name VARCHAR(50),    last_name VARCHAR(50),    email VARCHAR(50),    age INT,    gender VARCHAR(50),    company VARCHAR(50) ); insert into employees (id, first_name, last_name, email, age, gender, company) values (1, 'Nicolas', 'Skeates', 'nskeates0@zdnet.com', 50, 'Male', 'Kwinu'); insert into employees (id, first_name, last_name, email, age, gender, company) values (2, 'Valentijn', 'Digwood', 'vdigwood1@washingtonpost.com', 40, 'Male', 'Yabox'); insert into employees (id, first_name, last_name,...

  • CREATE TABLE DEPT ( DEPTNO INTEGER NOT NULL, DNAME VARCHAR(14), LOC VARCHAR(13), PRIMARY KEY (DEPTNO)); INSERT...

    CREATE TABLE DEPT ( DEPTNO INTEGER NOT NULL, DNAME VARCHAR(14), LOC VARCHAR(13), PRIMARY KEY (DEPTNO)); INSERT INTO DEPT VALUES (10,'SPORTS','NEW YORK'); INSERT INTO DEPT VALUES (20,'HOME','DALLAS'); INSERT INTO DEPT VALUES (30,'OUTDOOR','CHICAGO'); INSERT INTO DEPT VALUES (40,'CLOTHING','BOSTON'); CREATE TABLE EMP ( EMPNO INTEGER NOT NULL, ENAME VARCHAR(10), JOB VARCHAR(9), MGR INTEGER, SAL FLOAT, COMM FLOAT, DEPTNO INTEGER NOT NULL, FOREIGN KEY (DEPTNO) REFERENCES DEPT (DEPTNO), FOREIGN KEY (MGR) REFERENCES EMP(EMPNO), PRIMARY KEY (EMPNO)); INSERT INTO EMP VALUES (7839,'KING','PRESIDENT',NULL, 5000,NULL,10); INSERT INTO...

  • Overview: Database management plays an integral role in nearly every area of business. Databases house customer, accoun...

    Overview: Database management plays an integral role in nearly every area of business. Databases house customer, accounting, and employee data, and these different data sets must all be efficiently managed in order to make the data accessible. Companies rely on database engineers to ensure that their records are accurate, updated, and tracked in real time. This course covers structured query language (SQL) and how it can be used to manage database schemas, manipulate data, and analyze data. For your final...

  • Can someone please fix my SQL SELECT code? I keep getting column ambiguously defined error. /*8....

    Can someone please fix my SQL SELECT code? I keep getting column ambiguously defined error. /*8. List the students who have received any numeric grade score of at least 95 in an Advanced Java Programming course. Show student name, the grade type code, and the numeric grade.*/ SELECT STUDENT_ID, FIRST_NAME, LAST_NAME, GRADE_TYPE_CODE, NUMERIC_GRADE FROM STUDENT JOIN ENROLLMENT ON STUDENT.STUDENT_ID = ENROLLMENT.STUDENT_ID JOIN SECTION ON ENROLLMENT.SECTION_ID = SECTION.SECTION_ID JOIN COURSE ON SECTION.COURSE_NO = COURSE.COURSE_NO JOIN GRADE ON STUDENT.STUDENT_ID = GRADE.STUDENT_ID WHERE...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT