In this exercise, you will need the Library-database, which is described in Here . You can initialize the Library database like this:
- Download the file library.sql
- Execute the code from the file in your SQL-client
SELECT and WHERE / Library database
Make Query which,...
- Shows all data from all fields in borrower-table.
- Shows firstnames and lastnames in borrower table in alphabetical order based to lastname.
- Shows all postalcodes, but same code should be mentioned only once.
- Shows first 5 rows in borrower-table (use Google to find the answer).
- Shows rows 6-10 in borrower table.
- Shows all fields from borrower if id_borrower is 9.
- Shows all fields from borrower if id_borrower is 9 or 11.
- Shows all fields from borrower if id_borrower is 9 or 11 or 13.
- Shows all fields from borrower if id_borrower is 5-10.
- Shows all fields from borrower if id_borrower is not 5-10.
- Shows all fields from borrower if id_borrower is 1-12 and postalcode is 90101.
- Shows borrower's lastname and firstname if firstname is Carla.
- Shows borrower's lastname and firstname if firstname is Carla or Ralph.
- Shows borrower's lastname and firstname if streetaddress is Uusikatu 4 or Isokatu 66.
- Shows borrower's lastname and firstname if the person doesn't have a phone.
- Shows borrower's lastname and firstname and phone numbers if the person has phone.
- MySQL has several functions which will return current date. Use Google to find out them.
You can test them by writing Query: "SELECT function-name;"
- Shows all fields from Borrow-table if the book is late.
LIKE / Library database
Make Query which,...
- Shows all fields from book if the book name starts with 'A'
- Shows all fields from book if the book name includes word Management
- Shows all fields from book if the book name includes letter e
- Shows all fields from book if the book name includes letter e and a
- Shows firstnames and lastnames of borrower's who lives on Isokatu
- Shows firstnames and lastnames and phonenumber of borrower, which phonenumber starts with 040