Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Student : studentId a string of 3 characters, name (20) and city (15) are variable character strings. StudentId is the primary key. SummerJob : jobId

Student : studentId a string of 3 characters, name(20) and city(15) are variable character strings. StudentId is the primary key.

SummerJob: jobId a string of 5 characters, worktype (25) a variable string, company (20), a variable string, city (20), a variable string and hrlyWage, a number with at least 2 digits of precision after the decimal point. JobId is the primary key.

Student_Job: StudentId, JobId, hrsWorked (an integer), StartDate and EndDate. StartDate and EndDate are Date types. Primary Key is (StudentId, JobId). StudentId is a foreign key into Student Table and JobId is a foreign key into SummerJob table. HrsWorked are hours per day.

Creating tables and inserting values

Create tables using schemas given above, clearly defining the primary and foreign key constraints.

Insert values of your choice into the tables (at least five rows per table).

SQL Queries

Write and run the the following queries using SQL.

1) Find the names of student who live and work in the same city.

2) Show the Companies (and their cities) that pay the highest hrly wage.

3) Find the student id, jobid and the no.of days worked she/he worked in that job. DaysWorked can be obtained by endDate-startDate.

4) Show the names of students currently not working in any job.

5) Show the city and the number of Summer jobs available in that city.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Information And Database Systems 6th Asian Conference Aciids 2014 Bangkok Thailand April 7 9 2014 Proceedings Part I 9 2014 Proceedings Part 1 Lnai 8397

Authors: Ngoc-Thanh Nguyen ,Boonwat Attachoo ,Bogdan Trawinski ,Kulwadee Somboonviwat

2014th Edition

3319054759, 978-3319054759

More Books

Students also viewed these Databases questions

Question

1. How will you, as city manager, handle these requests?

Answered: 1 week ago