The following query is used to denormalize the table using inner join;
SELECT cust.customerid, cust.firstname, cust.lastname, cust.phone, cust.email, inv.invoicenumber, inv.datein, inv.dateout, inv.subtotal, inv.tax, inv.amount, item.itemnumber, item.serviceid, item.quantity, item.unitprice, item.extendedprice, serv.servicedescription, serv,unitprice FROM Customer as cust INNER JOIN Invoice as inv on cust.customerid = inv.customerid INNER JOIN InvoiceItem as item on item.invoicenumber = inv.invoicenumber INNER JOIN Service as serv on serv.serviceid = item.serviceid
As you can see the from the previous answer using the relations of Foreign Key and Primary Key on the respective tables the inner joins are denormalized i.e. it forms one table which has the combined records of all the four tables.
Hope this answers your questions and you give a positive feedback :")
Answer this from the following tables: 1. Create the logic model based in the tables provided....
Create SQL statements based on the given tables: Code to create the tables: CREATE DATABASE LAB4DB; USE LAB4DB; CREATE TABLE CUSTOMER ( CUS_CODE int primary key, CUS_LNAME varchar(15), CUS_FNAME varchar(15), CUS_INITIAL varchar(1), CUS_AREACODE varchar(3), CUS_PHONE varchar(8), CUS_BALANCE float(8) ); INSERT INTO CUSTOMER VALUES('10010','Ramas','Alfred','A','615','844-2573','0'); INSERT INTO CUSTOMER VALUES('10011','Dunne','Leona','K','713','894-1238','0'); INSERT INTO CUSTOMER VALUES('10012','Smith','Kathy','W','615','894-2285','345.86'); INSERT INTO CUSTOMER VALUES('10013','Olowski','Paul','F','615','894-2180','536.75'); INSERT INTO CUSTOMER VALUES('10014','Orlando','Myron','','615','222-1672','0'); INSERT INTO CUSTOMER VALUES('10015','O''Brian','Amy','B','713','442-3381','0'); INSERT INTO CUSTOMER VALUES('10016','Brown','James','G','615','297-1228','221.19'); INSERT INTO CUSTOMER VALUES('10017','Williams','George','','615','290-2556','768.93'); INSERT INTO CUSTOMER VALUES('10018','Farriss','Anne','G','713','382-7185','216.55'); INSERT INTO CUSTOMER VALUES('10019','Smith','Olette','K','615','297-3809','0'); /*...
Solve the following problems using either Tables 11-1 or 11-2 from your text. When necessary, create new table factors. (Round new table factors to five decimal places, round dollars to the nearest cent and percents to the nearest hundredth of a percent) a.Refer to Narrative 11-1. Calculate the compound interest on an investment of $45,000 at 6% interest, compounded quarterly, for 3 years. b.Refer to Narrative 11-1. You wish to have $17,000 in 11 years. Find how much you should...
Solve the following problems using either Tables 11-1 or 11-2 from your text. When necessary, create new table factors. (Round new table factors to five decimal places, round dollars to the nearest cent and percents to the nearest hundredth of a percent) a.Refer to Narrative 11-1. Omar invests $3,000 at 12% interest, compounded semiannually for 2 years. Calculate the effective interest rate for his investment. (Round to nearest hundredth percent) b.Solve the following problems using either Tables 11-1 or 11-2...
Question 1.Write a SQL statement for each of the following questions based on the above tables (50 Points). 1) Create “Enrollment” table. 2) Change the credits of “Database” course from 2 to 3. 3) List the course titles (not Course_No) and grades John Doe had taken. 4) Calculate average of Café Balance, and name new field as Average Balance. 5) Create a roster for “Database” course (list student ID, last name, first name, major, and status for each student enrolled...
Use the following information about Company X to help answer problems 1-10. Company X went public at the start of 2016, $100M shares of stock were issued at $18.60 per share. At the end of 2016, Company X traded at $20.00 per share. During 2017, Company X issued 5 shares at $20.00 per share, thus raising $100M of capital At the end of 2017, Company X traded at $20.46 per share. A summary of Company X's 2016 and 2017 10k...