I just need the SQL Queries Write an SQL query to retrieve r
I just need the SQL Queries.
Write an SQL query to retrieve records from one of the tables in the JustLee Books database. In a search condition, include the LIKE operator with either % or _ (or both).
Write an SQL query to retrieve records from one of the tables in the JustLee Books database. In a search condition, include the IS NULL operator.
Write an SQL query to retrieve records from one of the tables in the JustLee Books database. In a search condition, include multiple conditions using logical operators (AND and OR).
Write a complex SQL query to retrieve records from one of the tables in the JustLee Books database. In a search condition, use logical operators to join multiple conditions that include at least one of the arithmetic operators and one of the special operators. Use the ORDER BY statement to order the output.
The following is the database in question.
CREATE TABLE Customers
(Customer# NUMBER(4),
LastName VARCHAR2(10) NOT NULL,
FirstName VARCHAR2(10) NOT NULL,
Address VARCHAR2(20),
City VARCHAR2(12),
State VARCHAR2(2),
Zip VARCHAR2(5),
Referred NUMBER(4),
Region CHAR(2),
CONSTRAINT customers_customer#_pk PRIMARY KEY(customer#),
CONSTRAINT customers_region_ck
CHECK (region IN (\'N\', \'NW\', \'NE\', \'S\', \'SE\', \'SW\', \'W\', \'E\')) );
INSERT INTO CUSTOMERS
VALUES (1001, \'MORALES\', \'BONITA\', \'P.O. BOX 651\', \'EASTPOINT\', \'FL\', \'32328\', NULL, \'SE\');
INSERT INTO CUSTOMERS
VALUES (1002, \'THOMPSON\', \'RYAN\', \'P.O. BOX 9835\', \'SANTA MONICA\', \'CA\', \'90404\', NULL, \'W\');
INSERT INTO CUSTOMERS
VALUES (1003, \'SMITH\', \'LEILA\', \'P.O. BOX 66\', \'TALLAHASSEE\', \'FL\', \'32306\', NULL, \'SE\');
INSERT INTO CUSTOMERS
VALUES (1004, \'PIERSON\', \'THOMAS\', \'69821 SOUTH AVENUE\', \'BOISE\', \'ID\', \'83707\', NULL, \'NW\');
INSERT INTO CUSTOMERS
VALUES (1005, \'GIRARD\', \'CINDY\', \'P.O. BOX 851\', \'SEATTLE\', \'WA\', \'98115\', NULL, \'NW\');
INSERT INTO CUSTOMERS
VALUES (1006, \'CRUZ\', \'MESHIA\', \'82 DIRT ROAD\', \'ALBANY\', \'NY\', \'12211\', NULL, \'NE\');
INSERT INTO CUSTOMERS
VALUES (1007, \'GIANA\', \'TAMMY\', \'9153 MAIN STREET\', \'AUSTIN\', \'TX\', \'78710\', 1003, \'SW\');
INSERT INTO CUSTOMERS
VALUES (1008, \'JONES\', \'KENNETH\', \'P.O. BOX 137\', \'CHEYENNE\', \'WY\', \'82003\', NULL, \'N\');
INSERT INTO CUSTOMERS
VALUES (1009, \'PEREZ\', \'JORGE\', \'P.O. BOX 8564\', \'BURBANK\', \'CA\', \'91510\', 1003, \'W\');
INSERT INTO CUSTOMERS
VALUES (1010, \'LUCAS\', \'JAKE\', \'114 EAST SAVANNAH\', \'ATLANTA\', \'GA\', \'30314\', NULL, \'SE\');
INSERT INTO CUSTOMERS
VALUES (1011, \'MCGOVERN\', \'REESE\', \'P.O. BOX 18\', \'CHICAGO\', \'IL\', \'60606\', NULL, \'N\');
INSERT INTO CUSTOMERS
VALUES (1012, \'MCKENZIE\', \'WILLIAM\', \'P.O. BOX 971\', \'BOSTON\', \'MA\', \'02110\', NULL, \'NE\');
INSERT INTO CUSTOMERS
VALUES (1013, \'NGUYEN\', \'NICHOLAS\', \'357 WHITE EAGLE AVE.\', \'CLERMONT\', \'FL\', \'34711\', 1006, \'SE\');
INSERT INTO CUSTOMERS
VALUES (1014, \'LEE\', \'JASMINE\', \'P.O. BOX 2947\', \'CODY\', \'WY\', \'82414\', NULL, \'N\');
INSERT INTO CUSTOMERS
VALUES (1015, \'SCHELL\', \'STEVE\', \'P.O. BOX 677\', \'MIAMI\', \'FL\', \'33111\', NULL, \'SE\');
INSERT INTO CUSTOMERS
VALUES (1016, \'DAUM\', \'MICHELL\', \'9851231 LONG ROAD\', \'BURBANK\', \'CA\', \'91508\', 1010, \'W\');
INSERT INTO CUSTOMERS
VALUES (1017, \'NELSON\', \'BECCA\', \'P.O. BOX 563\', \'KALMAZOO\', \'MI\', \'49006\', NULL, \'N\');
INSERT INTO CUSTOMERS
VALUES (1018, \'MONTIASA\', \'GREG\', \'1008 GRAND AVENUE\', \'MACON\', \'GA\', \'31206\', NULL, \'SE\');
INSERT INTO CUSTOMERS
VALUES (1019, \'SMITH\', \'JENNIFER\', \'P.O. BOX 1151\', \'MORRISTOWN\', \'NJ\', \'07962\', 1003, \'NE\');
INSERT INTO CUSTOMERS
VALUES (1020, \'FALAH\', \'KENNETH\', \'P.O. BOX 335\', \'TRENTON\', \'NJ\', \'08607\', NULL, \'NE\');
Solution
select * from customers where REFERRED IS NULL
select * from customers where REGION LIKE \'S_\'
AND Region LIKE \'N%\'
select * from Customers where REGION=\'NE\' AND REGION=\'SW\'
select * from Customers where state=\'CA\' OR state=\'FL\' ORDER BY number desc

