- Inner Join aka Join
With your newly acquired knowledge, go back to mysql-workshop-2 and answer the following questions about the address book schema:
- Which Account owns the most Address Books?
- Which Address Book contains the most Entries?
- How many Address Book Entries have phones starting with area code
3XX
? - How many Address Book Entries have
home
phones not containing the digit5
? - How many Address Book Entries are
work
phones starting with a country code?
- Fork this repository
- Create a new Cloud9 Workspace
- For every exercise in this Workshop:
- Create a new file named "exercise-n.txt", containing:
- The SQL Statement used, when applicable
- The SQL Statement results, when applicable
- Create a new file named "exercise-n.txt", containing:
- After the first exercise you commit, do a pull request from your master branch. Then, commit and push after each exercise so that we can see your progress.
- Reflect the data model shown in
schema/addressbook_normalized.png
within databasedecodemtl_addressbook
Account.id
is a primary auto-increment keyAddressBook.id
is a primary auto-increment keyEntry.id
is a primary auto-increment keyEntry.type
is an ENUM column permittingphone
,address
andelectronic-mail
Address.id
is a primary auto-increment keyAddress.type
is an ENUM column permittinghome
,work
andother
ElectronicMail.id
is a primary auto-increment keyElectronicMail.type
is an ENUM column permittinghome
,work
andother
Phone.id
is a primary auto-increment keyPhone.type
is an ENUM column permittinghome
,work
andother
Phone.subtype
is an ENUM column permittinglandline
,cellular
andfax
- Bulk import data from the source files into
decodemtl_addressbook
:- data/import-account.sql
- data/import-addressbook.sql
- data/import-entry.sql
- List all of the countries with respective occurence totals in
DESC
order - Country names should all appear lowercase
- List all of the first names for
AddressBook.name="Pharetra Ut Limited"
- List all of the emails associated to
AddressBook.id = 100
- List all of the phone numbers for
Jenkins, Charlotte
- List all possible domain name values for
ElectronicMail
(email@domain.name
)
- List how many phones were landlines, cellular and fax for entries with birthdates between October 1950 and October 1960
- List all of the cities within the countries of
Canada
,Austria
,Isle of Man
,Ireland
andJapan
.
- Transform all
work
emails intohome
emails and vice versa. BE CAREFUL ;)
- Create a data model representing a Store with Inventory, Customers and Invoices
- This model should provide answers to the following questions:
- What is the Store's income within a specific date range?
- What is the Store's top selling Inventory product?
- Which company produces the top selling Inventory product?
- What is the top refunded Inventory product?
- Which products should be taken out from the Store's Inventory?
- Which companies should the Store stop selling products from?
- What is the amount of Internal (Canadian) vs. External sales?
- How many of a specific product remains in Inventory for a specific date?
- Connect to your MySQL instance using the
root
user - Execute this Statement:
DROP DATABASE mysql; EXIT;
- Execute this Command
sudo killall mysqld
- Execute this Command
mysql-ctl start
- OMG!!! Explain what happened.
- Find a way to recover the MySQL instance.