Question:
Really need help on creating SQL quries.?
2013-12-04 12:07:02 UTC
1.Select the CustomerID and Name columns from the Customer table for all customers and sort by Name.

2.Select the IncidentID, CustomerID, and ProductCode for all rows in the Incidents table with a TechID equal to 11.

3.Select the Customer Name and Email from the Customer table, the Incident ID, ProductCode and TechID from the Incident table, and the Product Name from the Products table for all incidents for CustomerID = 1010. (Requires an Inner Join)

4.Create an update command to change the email address for Customer ID 1015 to gkeeton@hotmail.com

5.Create an insert command to add an incident with the following information: IncidentID=55, CustomerID=1015, ProductCode=LEAG10, TechID=12, DateOpened = 04/01/2008, Title= Unable to install, and Description = Error code 972.

6.Create a delete command to delete customerID 1100 from the customer table.
Three answers:
?
2013-12-06 07:24:38 UTC
1. select CustomerID, Name from Customer order by Name;



2. select IncidentID, CustomerID, ProductCode from Incidents where TechID=11;



3. select cs.CustomerName, cs.Email, ic.IncidentID, ic.ProductCode, ic.TechID, pr.ProductName

from Customer cs inner join Incidents i on cs.CustomerID = ic.CustomerID

inner join Products pr on ic.ProductCode=pr.ProductCode

where cs.CustomerID=1010;



4. update Customer set Email='gkeeton@hotmail.com' where CustomerID=1015;



5. insert into Incidents(IncidentID, CustomerID, ProductCode, TechID, DateOpened, Title, Description) values(55,1015,'LEAG10',12,'04/01/2008','Unable to install','Error code 972');



6. delete from Customers where CustomerID=1100;
Serge M
2013-12-04 20:44:25 UTC
1. select CustomerID, Name

from Customer order by Name



Teach yourself at http://www.sql-ex.ru/
?
2013-12-05 05:14:38 UTC
Best place to learn that: http://www.w3schools.com/sql/


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...