Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Perform the following operations using SQL. 1. Create the following tables and f

ID: 3763001 • Letter: P

Question

Perform the following operations using SQL.

1. Create the following tables and fill them with the data.

Table Name: students

| id | name | birth | gpa | grad |

| 1 | Anderson | 1987-10-22 | 3.9 | 2009 |

| 2 | Jones | 1990-04-16 | 2.4 | 2012 |

| 3 | Hernandez | 1989-08-12 | 3.1 | 2011 |

| 4 | Chen | 1990-02-04 | 3.2 | 2011 |

Table Name: courses

| id | number | name | quarter |

| 1 | CS142 | CP II | Winter 2015 |

| 2 | ART101 | Finger painting | Fall 2014 |

| 3 | ART101 | Finger painting | Winter 2015 |

| 4 | PE204 | Mud wrestling | Winter 2015 |

Create a join table courses_students describing which students took which courses.

course_id | student_id |

| 1 | 1 |

| 3 | 1 |

| 4 | 1 |

| 1 | 2 |

| 2 | 2 |

| 1 | 3 |

| 2 | 4 |

| 4 | 4

Explanation / Answer

----------------------------------------------------------------------------------------------------------------------------------------------------------------------

CREATE TABLE courses (id int,numbers varchar(30),name varchar(30),quarter varchar(20));
INSERT INTO courses( id,numbers,name,quarter) VALUES ( 1,'CS142','CP II','Winter 2015');
INSERT INTO courses( id,numbers,name,quarter) VALUES ( 2,'ART101','Finger painting','Fall 2014');
INSERT INTO courses( id,numbers,name,quarter) VALUES ( 3,'ART101','Finger painting','Winter 2015');
INSERT INTO courses( id,numbers,name,quarter) VALUES ( 4,'PE204','Mud wrestling' ,'Winter 2015');

--- The provided Data is not complete to show the desired results. But you can use this sql query for the same purpose.

SELECT courses.id, students.id FROM students,courses where students.id=courses.id;