Once a table is created using Data Definition Language (DDL), the data can be inserted, viewed,...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Once a table is created using Data Definition Language (DDL), the data can be inserted, viewed, updated and deleted using Data Manipulation Language (DML) as part of SQL. The way to retrieve the records from a table is through the use of the SELECT statement, referred to as a query. This statement allows you choose the columns of interest and the rows based on a various criteria. But first, you must be able to add data to the tables using an INSERT statement. Records in a table may need to be modified or removed. The UPDATE statement is used to change the values in records; the DELETE statement is used to remove records. It is important to note that the WHERE clause plays an important role in these statements. Like the SELECT statement, the WHERE clause filters the rows to which the statement applies. Without the WHERE clause, the UPDATE or DELETE applies to all rows. Please note, referential integrity is maintained by these statements. For example, if there are sales records that relate to a customer, the customer record cannot be deleted. The related sales records must be deleted before the customer recorded can be deleted. Course Learning Outcomes Evaluated in this Assignment Demonstrate the use of the SELECT statement using SQL's Data Manipulation Language (DML) to query data in a database. Demonstrate the use of the INSERT statement using DML to add data to a database. Demonstrate the use of the DELETE statement using DML to delete data from a database. Demonstrate the use of the UPDATE statement using DML to change the data in a database. Instructions You are writing an application that keeps track of a membership list. You need to record the member's first name, last name, phone number, email address, city and date of birth. Each member is assigned a unique ID. 1. Write a single script to: a. Create a database called Membership b. Create a table that meets the requirements above 2. Write a script to add 10 members to the table. When creating this test list, make sure of the following: a. At least 2 members live in the same city b. At least 2 members have an email address in the same domain (the part after the @ sign). For example, at least 2 members with @gmail.com in their email address) The ID, first name, last name and date of birth are required. c. 3. Write a script containing queries to get: a. All rows and all columns b. All rows showing last name, first name and date of birth, in that column order. All rows showing city, last name and first name, in that column order, and sorted by city. All rows showing date of birth, last name, first name and email address, in that column order, and sorted by date of birth in descending order. e. All rows showing city, last name and first name where the city name is the one that you chose to be duplicated (item 2a above). f. All rows showing the last name, first name and email address where the email domain was duplicated (item 2b above). g. All rows showing the last name, city, email address and date of birth, in that order, sorted by date of birth, and where the city is the one where the city is duplicated (item 2a above) C. d. 4. Write a script that will: a. Change the phone number of one specific member (your choice) b. Change the city name of those members where the city is the same (item 2a above) C. Remove the email address of those members where the domain is duplicated (item 2b above) d. Delete the record of a specific member (your choice) e. Delete the records where the last name of the members end with 'son', even if you have no records that meet this criteria. 5. In all of the above queries, assume that you may have more data in the database, not just the sample data you provided. 6. Submit all four scripts. You may choose the name of the scripts, but use something descriptive. Once a table is created using Data Definition Language (DDL), the data can be inserted, viewed, updated and deleted using Data Manipulation Language (DML) as part of SQL. The way to retrieve the records from a table is through the use of the SELECT statement, referred to as a query. This statement allows you choose the columns of interest and the rows based on a various criteria. But first, you must be able to add data to the tables using an INSERT statement. Records in a table may need to be modified or removed. The UPDATE statement is used to change the values in records; the DELETE statement is used to remove records. It is important to note that the WHERE clause plays an important role in these statements. Like the SELECT statement, the WHERE clause filters the rows to which the statement applies. Without the WHERE clause, the UPDATE or DELETE applies to all rows. Please note, referential integrity is maintained by these statements. For example, if there are sales records that relate to a customer, the customer record cannot be deleted. The related sales records must be deleted before the customer recorded can be deleted. Course Learning Outcomes Evaluated in this Assignment Demonstrate the use of the SELECT statement using SQL's Data Manipulation Language (DML) to query data in a database. Demonstrate the use of the INSERT statement using DML to add data to a database. Demonstrate the use of the DELETE statement using DML to delete data from a database. Demonstrate the use of the UPDATE statement using DML to change the data in a database. Instructions You are writing an application that keeps track of a membership list. You need to record the member's first name, last name, phone number, email address, city and date of birth. Each member is assigned a unique ID. 1. Write a single script to: a. Create a database called Membership b. Create a table that meets the requirements above 2. Write a script to add 10 members to the table. When creating this test list, make sure of the following: a. At least 2 members live in the same city b. At least 2 members have an email address in the same domain (the part after the @ sign). For example, at least 2 members with @gmail.com in their email address) The ID, first name, last name and date of birth are required. c. 3. Write a script containing queries to get: a. All rows and all columns b. All rows showing last name, first name and date of birth, in that column order. All rows showing city, last name and first name, in that column order, and sorted by city. All rows showing date of birth, last name, first name and email address, in that column order, and sorted by date of birth in descending order. e. All rows showing city, last name and first name where the city name is the one that you chose to be duplicated (item 2a above). f. All rows showing the last name, first name and email address where the email domain was duplicated (item 2b above). g. All rows showing the last name, city, email address and date of birth, in that order, sorted by date of birth, and where the city is the one where the city is duplicated (item 2a above) C. d. 4. Write a script that will: a. Change the phone number of one specific member (your choice) b. Change the city name of those members where the city is the same (item 2a above) C. Remove the email address of those members where the domain is duplicated (item 2b above) d. Delete the record of a specific member (your choice) e. Delete the records where the last name of the members end with 'son', even if you have no records that meet this criteria. 5. In all of the above queries, assume that you may have more data in the database, not just the sample data you provided. 6. Submit all four scripts. You may choose the name of the scripts, but use something descriptive.
Expert Answer:
Related Book For
Data Modeling and Database Design
ISBN: 978-1285085258
2nd edition
Authors: Narayan S. Umanath, Richard W. Scammel
Posted Date:
Students also viewed these databases questions
-
NASA astronomers are planning on sending a space probe to orbit around an exoplanet and then eventually return to earth. The space probe will orbit the exoplanet 3 0 0 miles above its surface. The...
-
This data set represents the web server hit logs for a single website for a single day. You're going to do some analysis of the data, but first you need to normalize it properly -- which requires...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Raheem & Co. purchased a fixed asset on 1.4.2018 for Rs.2,50,000. Depreciation is to be provided @10% annually according to the Straight-line method. The books are closed on 31st March every year....
-
The Roberval balance is in equilibrium when no weights are placed on the pans A and B. If two masses mA and mB are placed at any location a and b on the pans, show that equilibrium is maintained if...
-
Find m for the investment of $1000.00 for 2 years at 1.8% compounded semi-annually.
-
This exercise considers nursing home data provided by the Wisconsin Department of Health and Family Services (DHFS) and described in Exercises 1.2 and 2.10. You decide to examine the relationship...
-
Steady-state temperatures at selected nodal points of the symmetrical section of a flow channel are known to be T2 = 95.47C, T3 = 117.3C, T5 = 79.79C, T6 = 77.29C, T8 = 87.28C, and T10 = 77.65C. The...
-
Suppose the real risk - free rate is 3 . 2 5 % and the future rate of inflation is expected to be constant at 2 . 3 0 % . What rate of return would you expect on a 1 - year Treasury security,...
-
Outside a home there is a keypad that will open the garage if the correct four-digit code is entered. (a) How many codes are possible? (b) What is the probability of entering the correct code on the...
-
a) After an axial strain Aa-0.9%, the deviatoric stress is measured to be 90 kPa. For this stage of the test, calculate the values of Ap, Ap', Aoa', Aor', Aa, and Eu. b) At this time, the axial...
-
Bell Computers assembles and sells notebook styled computers. The company is attempting to better manage cash flow and reduce inventory. The most recent strategy has been to require major vendors to...
-
Determine the "type" and "basic accounting" approach for each of the following categories of investments. Investment level generally over 20% but not giving control Investment level usually over 50%...
-
In the period in which an intercorporate sale occurs, how do the consolidation eliminating entries differ when unrealized profits pertain to an intangible asset rather than a tangible asset?
-
This problem requires you to carefully reread and think about the book's brief discussion on emerging trends in fair value reporting. As you do so, edit the following incorrect comments to make them...
-
Generalize the Fokker-Planck equation to the case of a particle executing Brownian motion in three dimensions. Determine the general solution of this equation and study its important features.
-
Which of the following is an Agile approach for work allocation in a team? Select the correct option(s) and click submit. Team Lead assigns work to team members without consulting them One of the...
-
Michelles trust is subject to 3.8% surtax on the lesser of the trusts net investment income or the excess of the trusts adjusted gross income over the $12,400 threshold (the highest trust tax rate)....
-
Consider the relation schema STUDENT (Sid, Shoe_size, Marital_status) F: fd1: Sid Shoe_size;...................fd2: Sid Marital_status a. Does STUDENT possess a multi-valued dependency? Why or why...
-
What is the difference between a loss-join decomposition and a lossless-join decomposition?
-
How do cardinality constraints and participation constraints relate to the notions of total and partial participation?
-
A construction engineer has to inspect 5 construction sites in a 2-day inspection schedule. He may or may not be able to visit these sites in two days. He will not visit any site more than once. (a)...
-
An explosion in an LNG storage tank in the process of being repaired could have occurred as the result of static electricity, malfunctioning electrical equipment, an open flame in contact with the...
-
What conditions for the binomial distribution, if any, fail to hold in the following situations? (a) For each of a company's eight production facilities, record whether or not there was an accident...
Study smarter with the SolutionInn App