In: Computer Science
SUPPLIERS(SupplierID, SupplierName, ContactName, Address, City, PostalCode, Country, Phone)
CUSTOMERS(CustomerID, CustomerName, ContactName, Address, City, PostalCode, Country)
1.Show suppliers that do not have a PO Box but only show those whose name starts with a G or an N
2.Show suppliers that are located in countries from A to G and cities from N to Z LastName: I got # records in the output (result set).
3.Show the set of city and country combinations (listing each combination only once) where our customers are located and show them by country in reverse alphabetical order then by city alphabetically LastName: I got # records in the output (result set).
4.Show the customers in with names from P to Y who are based out of London or New York LastName: I got # records in the output (result set).
5.Show customers with names ending in r but who also have an r as the third or fifth letter too LastName: I got # records in the output (result set).
Here are the solution. Please do upvote if i answered yur question.
1.Show suppliers that do not have a PO Box but only show those whose name starts with a G or an N
select * from SUPPLIERS where PostalCode is null and (SupplierName like '%G' or SupplierName like '%N');
2.Show suppliers that are located in countries from A to G and cities from N to Z LastName: I got # records in the output (result set).
select * from SUPPLIERS where (Country >= 'A' and Country < 'G') and (City >= 'N' and City < 'Z');
3.Show the set of city and country combinations (listing each combination only once) where our customers are located and show them by country in reverse alphabetical order then by city alphabetically LastName: I got # records in the output (result set).
select distinct City, Country from CUSTOMERS order by Country desc, City;
4.Show the customers in with names from P to Y who are based out of London or New York LastName: I got # records in the output (result set).
select * from CUSTOMERS where (CustomerName >= 'P' and CustomerName < 'Y') and City in ('London', 'New York');
5.Show customers with names ending in r but who also have an r as the third or fifth letter too LastName: I got # records in the output (result set).
select * from CUSTOMERS where CustomerName like '%r' and SUBSTR(CustomerName,3,1) = 'r' and SUBSTR(CustomerName,5,1) = 'r';