Given the default schema of a database: Customers 123 Customerld noc FirstName noc LastName noc City noc Country noc Phone Orders 123 Orderld OrderDate noc OrderNumber 123 Customerld 123 TotalAmount Orderltem 123 Itemid 123 Orderld 123 Productid 123 UnitPrice 123 Quantity Select one or more: Da. Customers Products h Ordoro 123 Productid noc ProductName 123 Supplierld 123 UnitPrice noc Package 123 IsDiscontinued Suppliers 123 Supplierld noc CompanyName noc ContactName noc ContactTitle noc City noc Country To display all the company names that supply 'coffee' products, which of the following tables are required in the FROM clause? Choose ALL that apply. noc Phone noc Fax
q6- Choose ALL that apply.
The SQL program for the given problem is as follows:
use demo;
Create table Suppliers(SupplierId int Not Null primary key,CompanyName varchar(30) Not null,
ContactName varchar (50), ContactTitle varchar(20) Not Null, City varchar(30) Not NULL,
Country varchar(30) Not NULL, Phone varchar(30) Not NULL, Fax varchar(30) Not NULL);
Insert into Suppliers(SupplierId,CompanyName,ContactName,ContactTitle, City, Country, Phone, Fax)
values (100001,"ABC","Mark","Henry","Alaska","USA","1023-7456-52", "1023-7456-52");
Insert into Suppliers(SupplierId,CompanyName,ContactName,ContactTitle, City, Country, Phone, Fax)
values (100002,"XYZ","Ken","Parker","California","USA","1023-3652-52", "1023-3652-52");
Insert into Suppliers(SupplierId,CompanyName,ContactName,ContactTitle, City, Country, Phone, Fax)
values (100003,"ABC","Matt","Viper","Alaska","USA","4523-6356-52", "4523-6356-52");
Insert into Suppliers(SupplierId,CompanyName,ContactName,ContactTitle, City, Country, Phone, Fax)
values (100004,"DEF","Harry","Potter","NYC","USA","1040-7456-70", "1040-7456-70");
Insert into Suppliers(SupplierId,CompanyName,ContactName,ContactTitle, City, Country, Phone, Fax)
values (100005,"XYZ","Lisa","Ray","NYC","USA","1440-7488-55", "1440-7488-55");
Create table Products(ProductId int Not Null primary key,ProductName varchar(30) Not null,
SupplierId int Not NULL, UnitPrice int Not Null, Package varchar(30) Not NULL,
isDiscontinued int Not NULL);
Insert into Products(ProductId, ProductName, SupplierId, UnitPrice, Package, isDiscontinued)
values (200001, "tea", 100001, 15, "P001", 1);
Insert into Products(ProductId, ProductName, SupplierId, UnitPrice, Package, isDiscontinued)
values (200002, "coffee", 100003, 20, "P002", 0);
Insert into Products(ProductId, ProductName, SupplierId, UnitPrice, Package, isDiscontinued)
values (200003, "coffee", 100004, 25, "P002", 1);
Insert into Products(ProductId, ProductName, SupplierId, UnitPrice, Package, isDiscontinued)
values (200004, "tea", 100004, 17, "P001", 1);
Insert into Products(ProductId, ProductName, SupplierId, UnitPrice, Package, isDiscontinued)
values (200005, "coffee", 100005, 22, "P002", 0);
Select Suppliers.CompanyName
From Suppliers, Products
Where Suppliers.SupplierId=Products.SupplierId AND Products.ProductName="coffee";
Step by step
Solved in 3 steps with 2 images