

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


create table producer ( ProducerID nvarchar( 10 ) primary key, ProducerName nvarchar( 50 ) not null, ProducerAddress nvarchar( 100 ) not null, ProducerContract int not null, ) Go create table product ( ProductId nvarchar ( 10 ) not null primary key, ProductName nvarchar( 50 ) not null, ProductImage nvarchar( 50 ) not null, ProductInfomation nvarchar( 100 ) not null, ProductPrice float not null, CatogeryID nvarchar( 10 ) not null, ProducerID nvarchar( 10 ) not null, --constraint FK1 foreign key (CatogeryID) references Catogery (CatogeryID), constraint FK2 foreign key (ProducerID) references Producer (ProducerID), ) go
insert into producer(ProducerID, ProducerName, ProducerAddress, ProducerContract)
values( 1 , 'John', 'London', 1324421 )
select P.ProducerID, P.ProducerName from producer as P where P.ProducerAddress = 'Tokyo'
select P.ProducerID, P.ProducerName, B.ProductName, B.ProductDetail from producer as P, product as B where P.ProducerID = B.ProducerID
Create a form that shows the product information of producers who live in London only
select P.ProducerId, P.ProducerName, B.ProductName, B.ProductInfomation, B.ProductId from producer as P left outer join product as B On P.ProducerId = B.ProducerId and P.ProducerAddress = 'london'