The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
CIS336: Lab 4: Introduction to Select, Insert, Update, and Delete Statements
LAB OVERVIEW
Lab 4 will introduce the various aspects of the SQL select statement and the methods of retrieving data from the database tables. This lab will also introduce the fundamentals of updating and deleting records. This lab may be completed using either DeVry’s Omnymbus EDUPE-APP lab environment, or a local copy of the MySQL database running on your own computer using the OM database tables. The lab will utilize a set of tables that are represented by the ERD (OM_ERD.docx) and are created and populated by the script file (create_OM_db.sql). Follow the instructions in the file CreateOMTables.docx to create your database, tables, and data.
A few IMPORTANT things to note if using EDUPE MySQL:
**There can be NO SPACES in alias names given to a column. For example:
Select unit_price as “Retail Price “ from items; --this does NOT work in EDUPE MySQL.
Any of the following WILL WORK:
Select unit_price as "RetailPrice" from items;
Select unit_price as "Retail_Price" from items;
Select unit_price as Retail_Price from items;
Select unit_price as RetailPrice from items;
**Any calculated fields MUST be given an alias (and note above NO SPACES in alias). For example:
selectunit_price * 2 from items; --this does NOT work in EDUPE MySQL
This will work:
selectunit_price * 2 as NewPricefrom items;
Deliverables
LAB STEPS: Complete each of the exercises below.
|
item_id: |
11 |
|
title: |
Ode To My ERD |
|
Artist_id: |
15 |
|
unit_price: |
12.95 |
ShowyourINSERT statement along with the results of the followingSELECT query to verify that the insert worked correctly.
select * from items where item_id> 10;
|
item_id: |
11 |
|
title: |
Ode To My ERD |
|
artist: |
15 |
|
unit_price: |
7.95 |
Show yourUPDATE statement along with the results of the followingSELECT query to verify that the insert worked correctly.
select * from items where item_id> 10;
Show your DELETE statement along with the results of the following SELECT query to verify that the insert worked correctly.
select * from items where item_id> 10;
Using the SUBSTRING and CONCAT functions, write a query to display each customer name as a single field in the format “Jones, Tom” with a heading of Customer along with the customer_phone field in a nicely formatted calculated column named Phone. For example, a record containing the customer_phone value 6145535443 would be output with parentheses, spaces, and hyphens, like this: (614) 555-5443. Sort by last name.
This is the end of Lab 4.