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 a Database (‘fdb’) using a

ID: 3773512 • Letter: P

Question

Perform the following operations using SQL.

1. Create a Database (‘fdb’) using any one from Oracle, Sybase, DB-2, SQL Server or MySQL

2. 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

3- Write SQL query to select students having GPA greater than 3 and the result should be sorted according to name.

4- Update student’s (Jones) GPA to 2.5.

5- Find all students who took a CS142 course.

6- Delete record of student named “Jones”.

7- Add one column (“degree”) to students table.

8- Delete table courses_students.

Explanation / Answer

Perform the following operations using SQL. 1. Create a Database (‘fdb’) using a