Question
The categories table describes the various product categories. CREATE TABLE categories ( CategoryID smallint primary key, CategoryName varchar(15) NOT NULL, Description text ); The products
The categories table describes the various product categories.
CREATE TABLE categories (
CategoryID smallint primary key,
CategoryName varchar(15) NOT NULL,
Description text
);
The products table has information about the products sold by the company.
CREATE TABLE products (
ProductID smallint primary key,
ProductName varchar(40) NOT NULL,
SupplierID smallint,
CategoryID smallint,
QuantityPerUnit varchar(20),
UnitPrice real,
UnitsInStock smallint,
UnitsOnOrder smallint,
ReorderLevel smallint,
Discontinued integer NOT NULL,
foreign key (CategoryID) references categories(CategoryID)
);
The customers table has information about the companies that buy the products. The customers of the import/export company are companies.
CREATE TABLE customers (
CustomerID char(8) primary key,
CompanyName varchar(40) NOT NULL,
CustomerName varchar(30),
CustomerTitle varchar(30),
Address varchar(60),
City varchar(15),
Region varchar(15),
PostalCode varchar(10),
Country varchar(15),
Phone varchar(24),
Fax varchar(24)
);
The orders table has information about orders placed by customers (companies) to the company. Orders are shipped via freight shipping.
CREATE TABLE orders (
OrderID smallint primary key,
CustomerID char(8),
EmployeeID smallint,
OrderDate date,
RequiredDate date,
ShippedDate date,
ShipVia smallint,
Freight real,
ShipName varchar(40),
ShipAddress varchar(60),
ShipCity varchar(15),
ShipRegion varchar(15),
ShipPostalCode varchar(10),
ShipCountry varchar(15),
foreign key (CustomerID) references customers(CustomerID)
);
The order_details table links orders with products.
CREATE TABLE order_details (
OrderID smallint NOT NULL,
ProductID smallint NOT NULL,
UnitPrice real NOT NULL,
Quantity smallint NOT NULL,
Discount real NOT NULL,
primary key (OrderID, ProductID),
foreign key (OrderID) references orders(OrderID),
foreign key (ProductID) references products(ProductID)
);
Q10 Find the city with the most companies. Show the city name and the company names.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started