Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Select all the columns from the students table and order them by last name +-----------+----------+-----------+-------+ | firstname | lastname | city | state |

1. Select all the columns from the students table and order them by last name +-----------+----------+-----------+-------+ | firstname | lastname | city | state | +-----------+----------+-----------+-------+ | Anne | Jones | Here | TN | | Fred | Smith | Here | KY | | Ben | Smith | There | KY | | Ted | Smith | Here | KY | | Jill | Smith | Somewhere | KY | +-----------+----------+-----------+-------+ 5 rows in set (0.00 sec) 2. Select all the columns from the students table and order them by last city +-----------+----------+-----------+-------+ | firstname | lastname | city | state | +-----------+----------+-----------+-------+ | Fred | Smith | Here | KY | | Ted | Smith | Here | KY | | Anne | Jones | Here | TN | | Jill | Smith | Somewhere | KY | | Ben | Smith | There | KY | +-----------+----------+-----------+-------+ 5 rows in set (0.00 sec) 3. Select all the columns from the students table and order them by city and state +-----------+----------+-----------+-------+ | firstname | lastname | city | state | +-----------+----------+-----------+-------+ | Fred | Smith | Here | KY | | Ted | Smith | Here | KY | | Anne | Jones | Here | TN | | Jill | Smith | Somewhere | KY | | Ben | Smith | There | KY | +-----------+----------+-----------+-------+ 5 rows in set (0.00 sec)

_______________THE TABLE____________________________

CREATE DATABASE DAVEINC;

USE DAVEINC;

CREATE TABLE EMPLOYEES (EMP_NUM DECIMAL(2,0), EMP_LAST CHAR(12), EMP_FIRST CHAR(10), ADDRESS VARCHAR (20), CITY CHAR (20), STATE CHAR (2), ZIP CHAR(5) );

CREATE TABLE VENDORS (VEN_CODE CHAR(4), VEN_NAME CHAR(40), CREDIT FLOAT(7,2) );

CREATE TABLE PRODUCTS (PRODUCT_NAME VARCHAR(30), PRICE FLOAT(5,2) );

INSERT INTO EMPLOYEES VALUES (1,'MorriS','Tony','123 Main','Allen','NY','23412'); INSERT INTO EMPLOYEES VALUES (2,'Smith','Paula','23 South Lane','Allen','SD','08262'); INSERT INTO EMPLOYEES VALUES (3,'Clark','Jenny','Route 12','Humming','OH','23576'); INSERT INTO EMPLOYEES VALUES (4,'Frank','Dave','12 Mocking Ln','Hastings','TN','83723'); INSERT INTO EMPLOYEES VALUES (5,'Stevens','April','78 West Ave','Humming','OH','23577'); INSERT INTO EMPLOYEES VALUES (6,'Kennedy','Lawance','78 West Street','Humming','OH','23578');

INSERT INTO EMPLOYEES VALUES (7,'Peters','Perry','83 West Street','Humming','OH','23578'); INSERT INTO EMPLOYEES VALUES (8,'Chenny','Terry','12 West Road','Allen','SD','08932'); INSERT INTO EMPLOYEES VALUES (9,'Clark','Hellen','57th Street','Corneth','NY','98756'); INSERT INTO EMPLOYEES VALUES (10,'Stevens','Jack','83rd Street','Westbridge','TN','83498'); INSERT INTO EMPLOYEES VALUES (11,'Williams','John','23rd Front Street','Lane','KY','45234'); INSERT INTO EMPLOYEES VALUES (12,'Hall','Colleen','34 West Road','Lane','KY','45234'); INSERT INTO EMPLOYEES VALUES (13,'Smith','Dorra','102 North Road','South','KY','42142'); INSERT INTO EMPLOYEES VALUES (14,'Bennet','June','12 South Road','Kidd','SD','08332' ); INSERT INTO EMPLOYEES VALUES (15,'Quinn','Laura','12 Main Street','Foto','NY','90832'); INSERT INTO EMPLOYEES VALUES (16,'Rain','Murry','PO BOX 282','Cake','KY','49872'); INSERT INTO EMPLOYEES VALUES (17,'Holmes','Cora','17 West Street','Allen','SD','19836'); INSERT INTO EMPLOYEES VALUES (18,'Tate','Remus','293 West Ave','South','KY','42142'); INSERT INTO EMPLOYEES VALUES (19,'Tate','Romus','34 Chicken Street','Egg','FL','78764'); INSERT INTO EMPLOYEES VALUES (20,'Moore','Misha','22 LG Drive','Kow','TX','67654'); INSERT INTO EMPLOYEES VALUES (21,'Cook','Anne','87 Glory Road','Tempus','FL','79832'); INSERT INTO EMPLOYEES VALUES (22,'Franks','Tim','23 Western Lane','Gadzooks','KY','41832'); INSERT INTO EMPLOYEES VALUES (23,'Dylan','Jane','11 East Street','Town','KY','44323'); INSERT INTO EMPLOYEES VALUES (24,'Crane','lee','1st Lane','Henry','MI','55343'); INSERT INTO EMPLOYEES VALUES (25,'Green','Lenny','23 Green Valley','Sunny','KY','43233'); INSERT INTO EMPLOYEES VALUES (26,'Ellis','Steve','Route 12','Logan','WV','62323'); INSERT INTO EMPLOYEES VALUES (27,'Lance','Tim','Route 234','Town','KY','44323'); INSERT INTO EMPLOYEES VALUES (28,'Jackson','Dylan','12 Glass Road','Sol','KY','49873'); INSERT INTO EMPLOYEES VALUES (29,'South','Mora','Route 23','Little John','WV','62345'); INSERT INTO EMPLOYEES VALUES (30,'Prince','Paul','39 South Bend','Bruce','VA','12938');

INSERT INTO PRODUCTS VALUES ('Hammer',12.99); INSERT INTO PRODUCTS VALUES('Stove',399.99); INSERT INTO PRODUCTS VALUES('Nails',1.99); INSERT INTO PRODUCTS VALUES('Mirror',300.99); INSERT INTO PRODUCTS VALUES('Lights',10.99); INSERT INTO PRODUCTS VALUES('Shelves',59.99); INSERT INTO PRODUCTS VALUES('Gas Range',599.99); INSERT INTO PRODUCTS VALUES('Electric Heater',29.99); INSERT INTO PRODUCTS VALUES('Repair Manual',15.99); INSERT INTO PRODUCTS VALUES('Floor Tiles',39.98); INSERT INTO PRODUCTS VALUES('Washer',199.95); INSERT INTO PRODUCTS VALUES('Dryer',299.95); INSERT INTO PRODUCTS VALUES('Sink',87.99); INSERT INTO PRODUCTS VALUES('2X4',10.50); INSERT INTO PRODUCTS VALUES('Sofa',234.95); INSERT INTO PRODUCTS VALUES('Couch',495.99); INSERT INTO PRODUCTS VALUES('Sofa Cover',49.95); INSERT INTO PRODUCTS VALUES('Wood Glue',8.75); INSERT INTO PRODUCTS VALUES('Tomato Plans',2.99); INSERT INTO PRODUCTS VALUES('Red Roses',24.95); INSERT INTO PRODUCTS VALUES('1 GB RAM',59.95); INSERT INTO PRODUCTS VALUES('WD 1TB Hard Drive',100.99); INSERT INTO PRODUCTS VALUES('CD ROM',34.99);

INSERT INTO VENDORS VALUES('01','GN FOODS', 1000.00); INSERT INTO VENDORS VALUES('02','Easy Out Inc', 2500.00); INSERT INTO VENDORS VALUES('03','OK Clothes', 550.00); INSERT INTO VENDORS VALUES('04','Spring Cleaners', 750.00); INSERT INTO VENDORS VALUES('05','Jason James Foods', 1500.00); INSERT INTO VENDORS VALUES('06','EK Support Inc', 1800.00); INSERT INTO VENDORS VALUES('07','George Tate Gym', 1800.00); INSERT INTO VENDORS VALUES('08','Up All Night Cleaners', 1600.00); INSERT INTO VENDORS VALUES('09','Junky Kars', 125.00); INSERT INTO VENDORS VALUES('10','Rosy Market', 1200.00); _______________________________________

ADD TO THE TABLE

create table STUDENTS

(firstname char(15), lastname char(15), city char(15), state char(2) );

INSERT INTO STUDENTS

VALUES('Fred','Smith', 'Here', 'KY');

INSERT INTO STUDENTS

VALUES('Ben','Smith', 'There', 'KY');

INSERT INTO STUDENTS

VALUES('Ted','Smith', 'Here', 'KY');

INSERT INTO STUDENTS

VALUES('Jill','Smith', 'Somewhere', 'KY');

INSERT INTO STUDENTS

VALUES('Anne','Jones', 'Here', 'TN');

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

SQL Database Programming

Authors: Chris Fehily

1st Edition

1937842312, 978-1937842314

More Books

Students also viewed these Databases questions

Question

a. How will the leader be selected?

Answered: 1 week ago