Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write the SQL statement that lists the city and the employees sorted in the descending order of employees . Write the SQL statement that lists

image text in transcribed

  1. Write the SQL statement that lists the city and the employees sorted in the descending order of employees.

  1. Write the SQL statement that lists the city and the employees sorted in the ascending order of employees.

  1. Write the SQL statement that lists the branchNo, the street, the city, and the employees of branches with number of employees more than 20.

  1. Write the SQL statement that lists the branchNo, the street, and the city of branches from London or Glasgow cities.

  1. Write the SQL statement that lists the branchNo, the street, the city, and the employees of branches with number of employees between 18 and 30. Note: Use the keyword BETWEEN to accomplish this task.

  1. Similarly, using a compound comparison search condition, write the SQL statement that lists the branchNo, the street, the city, and the employees of branches with number of employees between 18 and 30. Note: Dont use the keyword BETWEEN in this task.
Consider the Branches table as follows. branchNo B005 B007 B003 B004 B002 street 22 Deer Rd 189 Hudson St 81 Shepford St 250 Fifth Ave 56 Clover Dr city London New York Glasgow New York London postcode employees SW14EH 18 10013 22 G1199x 12 10001 32 NW16EU 26 Preliminary Tasks: A. Copy and paste the following code into your SQL Editor, then execute it. This code will create the table Branches and insert the above five records into it. CREATE TABLE Branches branchNo VARCHAR(4), street VARCHAR (20), city VARCHAR(15), postcode VARCHAR(10), employees INTEGER); INSERT INTO Branches VALUES ('B005', '22 Deer Rd', 'London', 'SW14EH',18); INSERT INTO Branches VALUES ('B007', '189 Hudson St', 'New York', '10013',22); INSERT INTO Branches VALUES ('B003','81 Shepford St', 'Glasgow', 'G1199x', 12); INSERT INTO Branches VALUES ('B004', '250 Fifth Ave', 'New York', '10001',32); INSERT INTO Branches VALUES ('B002', '56 Clover Dr', 'London', 'NW16EU',26); Note: To recreate the table, you will need to drop it first by running the following command. DROP TABLE Branches; B. To make sure all records are properly inserted, list the content of the Branches table by running the following statement. SELECT * FROM Branches

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

More Books

Students also viewed these Databases questions