Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Write a SELECT statement that returns these two columns: DepartmentName The DepartmentName column from the Departments table CourseID The CourseID column from the Courses

1. Write a SELECT statement that returns these two columns:

DepartmentName The DepartmentName column from the Departments table

CourseID The CourseID column from the Courses table Return one row for each Department with no courses. (Hint: Use an outer join and only return rows

where the CourseID column contains a null value.)

2. Write a SELECT statement that returns these columns:

InstructorDept

LastName FirstName CourseDescription CourseDept

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

The DepartmentName column from the Departments table for a related instructor

The LastName column from the Instructors table

The FirstName column from the Instructors table

The CourseDescription column from the Courses table

The DepartmentName column from the Departments table for a related instructor

Return one row for each course thats in a different department than the department of the instructor assigned to teach that course. (Hint: You will need to join the Departments table to both the Instructors table and the Courses table, which will require you to use table aliases to distinguish the two tables.)

Select * from courses Departments Instructorld 1 1 4 5 2 8 6 16 5 7 9 1 11 1 4 4 5 1 1 1 4 6 16 100 % Results i Messages CourselD CourseNumber Course Description CourseUnits 1 1 36598 Beginning Accounting 3 2 2 48926 Abstract Algebra 3 3 3 14862 Primary Education 3 4 4 54321 Anatomy 3 5 5 82754 Social Psychology 3 6 6 13524 Statistical Analysis 3 7 7 24653 Intro to Marketing 3 8 8 22679 Intro to Calculus 3 9 9 98765 Intermediate Accounting 3 10 10 96032 Social Media 3 11 11 58230 Physiology 3 12 12 81256 Intro to Management 3 13 13 64321 Secondary Education 3 14 14 32751 Business Writing 2 15 15 46972 Biology 4 16 16 15487 Music Theory 3 17 17 28177 Classic Literature 3 18 18 90908 Educational Theory 3 19 19 55783 Shakespeare 3 20 20 63284 Population and Demo... 3 21 21 74832 Creative Writing 3 22 22 33218 Marching Band 2 23 23 37645 Composition 3 24 24 84937 Microbiology 4 25 25 44386 Trigonometry 3 1 7 8 2 1 10 3 12 15 13 15 O W U W W NW U10 7 9 2 12 10 3 4 14 SQL Query15.sql - L..J3Q8DS\smitt (73))* + x Select * FROM Departments 100 % Results i Messages DepartmentID DepartmentName 1 1 Business 2 Education 3 English Mathematics 5 5 Music 6 8 Political Science 7 6 Science 8 Sociology w N Nm 4 4 5 7 SQL Query 14.sql - ...J3Q8DS\smitt (51))* + X SQLQuery13.sql - L...J3Q8DS\smitt (52))* SELECT * FROM instructors | Status F DepartmentChairman 1 0 FirstName Billy William Rachel Gene NULL L 0 LL LL 1 0 F 1 0 100 % Results i Messages Instructorld LastName 1 1 Brown 2 2 Thomas 3 3 Amundsen 4 4 Green 5 5 McGregor 6 6 Paxton 7 7 Rogers 8 8 Smith 9 9 Connors 10 10 Jones 11 11 Vilma 12 12 Thomas 13 13 Black 14 14 Warren 15 15 Drew 16 16 Gallegos Arnold NULL 0 1 9 Hire Date AnnualSalary DepartmentID 2016-01-10 77500.00 1 2016-03-30 38500.00 3 2016-06-05 79000.00 6 2016-08-02 75000.00 1 2017-01-03 74000.00 4 2017-07-15 36000.00 5 2017-10-22 38000.00 1 2018-02-05 73000.00 2 2018-03-04 71500.00 7 2018-09-21 74000.00 3 2018-11-18 35500.00 1 2019-01-17 35500.00 5 2019-04-20 34000.00 2 2019-07-14 33000.00 4 2019-08-25 72000.00 3 2020-03-23 64000.00 6 1 1 John Daniel Sally Jonathan Derrick Bill Angela Daniel Tomas 0 0 0 O O 0 Results StudentID Graduation Date 2019-12-14 1 1 2 2 3 2019-12-14 2019-05-07 3 4 4 2019-12-14 5 5 6 NULL 2019-12-14 2019-05-07 7 8 NULL 9 10 10 NULL NULL NULL 11 11 12 12 13 13 14 14 15 15 16 16 17 NULL 2019-12-14 NULL NULL NULL NULL NULL NULL NULL NULL 17 18 18 19 Messages LastName FirstName Howard Amber White George MacNamara Tony Welch Jonathan Taylor Donna Price Rose Rodriguez Jesse Williams Bonnie Kent Thomas Kramer Maggie DeLorean Cameron Sanchez Frank Smith Roberta Hoffman Wilma Bonwell Brian Clement Cal Patrick Charles Landry William Morrisey Monica Butler George Yount Anderson Rincon Anthony Hallowell Jimmy Flores Jesus Camden James Easton Barney Sommers Tanya Jones Andrew Jackson Floyd Geary Annette Osborne Letitia Manning Vincent Goodell Conner Griffin Gerald Gardner Faye Franks Karen Johnson Timothy Walker Andrew Cramsden Walter 19 EnrollmentDate 2015-12-18 16:44:26 2015-12-20 11:12:26 2015-12-21 09:21:55 2015-12-21 13:23:10 2015-12-28 10:32:16 2016-01-02 12:37:31 2016-01-03 13:08:37 2016-01-03 15:44:56 2016-07-15 11:14:23 2016-07-15 17:02:45 2016-07-18 12:48:43 2016-07-20 09:37:53 2016-07-22 11:18:25 2016-12-10 15:31:28 2016-12-12 14:22:53 2016-12-14 16:42:11 2016-12-22 08:43:48 2017-01-02 11:28:49 2017-01-04 10:42:06 2017-07-12 13:05:41 2017-07-18 14:21:07 2017-12-08 09:55:15 2017-12-19 13:44:25 2018-01-03 16:23:47 2018-01-04 11:12:31 2018-01-04 14:14:02 2018-07-22 15:41:12 2018-07-24 10:53:26 2018-07-25 09:27:53 2018-07-12 09:33:47 2018-12-12 17:14:22 2018-12-14 15:37:43 2019-01-02 14:21:58 2019-01-02 16:04:04 2019-07-22 08:15:57 2019-07-23 10:42:03 2019-08-04 09:01:04 2019-08-05 13:48:26 2019-12-15 10:18:37 20 20 21 21 22 22 NULL NULL 23 23 24 24 NULL NULL 25 25 26 26 NULL NULL 27 27 28 28 29 29 30 30 31 31 NULL NULL NULL NULL NULL NULL NULL 32 32 33 33 34 34 35 35 NULL NULL 36 36 37 37 NULL NULL 38 38 39 39 NULL

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_2

Step: 3

blur-text-image_3

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

Database Marketing The New Profit Frontier

Authors: Ed Burnett

1st Edition

0964535629, 978-0964535626

More Books

Students also viewed these Databases questions

Question

What are some career development methods?

Answered: 1 week ago

Question

=+5 Does this case provide an example of the future for IHRM?

Answered: 1 week ago

Question

=+4 How did it affect HR?

Answered: 1 week ago