1
create login albert with password='abc'
create user albert for login albert
create login adrian with password='abc'
create user adrian for login adrian
use Northwind
grant select to adrian
grant control to albert
create login albert with password='abc'
create user albert for login albert
create login adrian with password='abc'
create user adrian for login adrian
use CJDate
grant control to albert
grant select to adrian
create login albert with password='abc'
create user albert for login albert
create login adrian with password='abc'
create user adrian for login adrian
use AdventureWorks
grant control to albert
grant select to adrian
create login albert with password='abc'
create user albert for login albert
create login adrian with password='abc'
create user adrian for login adrian
use cos
grant control to albert
grant select to adrian
select * from sys.sysusers
2
A
select UnitPrice, ProductID, Orders.ShippedDate, Quantity
from [Order Details] od
join Orders on Orders.OrderID=od.OrderID
B
select UnitPrice, ProductID, Orders.OrderID, Quantity
from [Order Details]
join Orders on Orders.OrderID=[Order Details].OrderID
where YEAR(OrderDate)=1997
C
select OrderID,Customers.CompanyName,EmployeeID,OrderDate,RequiredDate,ShippedDate,ShipVia,Freight
from Orders
join Customers on Customers.CustomerID=Orders.CustomerID
D
select UnitPrice, ProductID, s.CompanyName, Quantity
from [Order Details] od
join
(select OrderID, Customers.CompanyName
from Orders o
join Customers
on Customers.CustomerID=o.CustomerID) s
on s.OrderID=od.OrderID
E
select [Order Details].UnitPrice, [Order Details].ProductID, Orders.ShippedDate, [Order Details].Quantity
from [Order Details], Orders
where Orders.OrderID=[Order Details].OrderID
F
select UnitPrice, s.ProductName, s.CategoryName, Quantity
from [Order Details] od
join
(select ProductID, ProductName, Categories.CategoryName
from Products p
join Categories
on Categories.CategoryID=p.CategoryID) s
on s.ProductID=od.ProductID
G
select distinct Customers.CompanyName
from [Order Details], Orders, Customers, Products, Categories
where Categories.CategoryName='Beverages'
H
select distinct Employees.FirstName, Employees.LastName
from [Order Details], Orders, Employees, Products, Categories
where Categories.CategoryName='Beverages'
I
select distinct Customers.CompanyName
from Orders, Customers
where YEAR(Orders.OrderDate)=1998
J
select distinct Products.ProductName
from [Order Details], Orders, Customers, Products
where Customers.Country='USA'
Wyszukiwarka
Podobne podstrony:
Lab4 1 R4 lab41lab4 sprHiPUA lab4i2 lab4Grabowska Lab4lab4 csproj FileListAbsolute (3)i9g1s1 wozniak lab4 sdlab4 srodowisko B&Rlab4AK lab4Kopia lab4 26810JPPO Lab4lab4 ZAwięcej podobnych podstron