Sei sulla pagina 1di 2

ASSIGNMENT-1(SQL SERVER) (for third year CS and IT branch )

P_Id 1 2 3 LastName Hansen Svendson Pettersen FirstName Ola Tove Kari Address Timoteivn 10 Borgvn 23 Storgt 20 City Sandnes Sandnes Stavanger

The table above contains three records (one for each person) and five columns (P_Id, LastName, FirstName, Address, and City).

Q1-we want to select the content of the columns named "LastName" and "FirstName" from the table above.
Q2-we want to select only the distinct values from the column named "City" from the table above. Q3-we want to select only the persons living in the city "Sandnes" from the table above. Q4- we want to select only the persons with the first name equal to "Tove" AND the last name equal to "Svendson": Q5-we want to select only the persons with the first name equal to "Tove" OR the first name equal to "Ola": Q6-we want to select only the persons with the last name equal to "Svendson" AND the first name equal to "Tove" OR to "Ola": Q7- we want to select all the persons from the table above, however, we want to sort the persons by their last name. Q8- we want to delete the person "Tjessem, Jakob" in the "Persons" table. Q9-we want to select only the two first records in the table above. 10- we want to select only 50% of the records in the table above. 11-we want to select the persons living in a city that starts with "s" from the table without using like 12-we want to select the persons with a last name equal to "Hansen" or "Pettersen" from the table above. 13-we want to select the persons with a last name alphabetically between "Hansen" and "Pettersen" from the table above.

1415-we want to list all the persons with any orders. 16- we want to list all the persons and their orders - if any, from the tables above. 17- we want to list all the orders with containing persons - if any, from the tables above. 18- we want to list all the persons and their orders, and all the orders with their persons. 19-we want to find the average value of the "OrderPrice" fields. 20-we want to find the customers that have an OrderPrice value higher than the average OrderPrice value. 21-we want to count the number of orders from "Customer Nilsen". 22- we want to count the number of unique customers in the "Orders" table. 23-we want to find the first value of the "OrderPrice" column. 24- we want to make an exact copy of the data in our "Persons" table.

Note-this is ur first assignment of sql server having basic question You have to submit it on 3/19/2012(Monday). Plz make a notebook for this assignment,becoz after this you have to submit 2 nd assignment and so on..

Potrebbero piacerti anche