Question

In: Computer Science

Consider the following data. Boardgames ID name price manuf_id 3234 Monopoly 60 HB 2244 Settlers of...

Consider the following data.

Boardgames

ID

name

price

manuf_id

3234

Monopoly

60

HB

2244

Settlers of Catan

45

MF

2389

Catan: Seafarers

20

MF

4211

Carcassonne

55

VG

4383

Citadels

35

HB

4450

Pandemic

55

VG

Manufacturer

ID

name

founded

HB

Hasbro

1997

MF

Mayfair Games

1982

VG

Ventura Games

2005

Answer the following:

  1. Write the SQL DDL statements to create the tables. Include primary and foreign keys.

Solutions

Expert Solution

Data definition language (DDL) statements let you to perform these tasks:
1. Create, alter, and drop schema objects.
2. Grant and revoke privileges and roles.
3.Analyze information on a table, index, or cluster.
4. Establish auditing options.
5. Add comments to the data dictionary.

Since the question asks only to create the structure of the table using SQL DDL and we can clearly see manuf_id is FOREIGN KEY in table Boardgames taking REFERENCE from ID column of table Manufacturer. Therefore we need to create Manufacturer before creating table Boardgames.
Hence, we will use CREATE TABLE statement in order as follows:-

CREATE TABLE Manufacturer(
ID varchar(2) PRIMARY KEY,
name varchar(20),
founded int(4)
);

CREATE TABLE Boardgames(
ID int(4) PRIMARY KEY,
name varchar(20),
price int(2),
manuf_id varchar(2),
FOREIGN KEY (manuf_id) REFERENCES Manufacturer (ID)
);

Hope this solves your Query.....


Related Solutions

Product(p-id, p-name, weight) Retailer(r-id, r-name, city) Sells(r-id, p-id, price)
  Product(p-id, p-name, weight)Retailer(r-id, r-name, city)Sells(r-id, p-id, price) r-id is a foreign key referencing Retailerp-id is a foreign key referencing Product Give a Relational Algebra expression : (IT IS NOT SQL) (a) Find the names of the retailers who are selling the products that have a weight greater than 10 kg.(b) Find the names of the retailers who have never sold a product that has a weight greater than 10 kg.(c) Get the price of the products that have a...
Consider the following relation AIRLINE TABLE Flight Date Flight ID Origin Destination Captain ID Captain Name...
Consider the following relation AIRLINE TABLE Flight Date Flight ID Origin Destination Captain ID Captain Name Number of Passengers on the Flight April 10 111 Chicago L.A. 111 Tracy 110 April 10 222 L.A. Phoenix 222 Matt 105 April 12 111 Chicago L.A. 444 Tim 98 April 12 333 L.A. N.Y. 111 Tracy 75 April 12 444 L.A. N.Y. 333 Pat 110 April 12 555 L.A. Dallas 444 Tim 111 April 12 222 L.A. Phoenix 555 Pat 107 Some of...
Consider the following naturally occurring forms of Hb. A. HbS (sickle-cell Hb): substitutes a V for...
Consider the following naturally occurring forms of Hb. A. HbS (sickle-cell Hb): substitutes a V for a E on the surface B. Hb Cowtown: eliminates an ion pair involved in T-state stabilization C. Hb Memphis: substitutes one uncharged polar residue for another of similar size on the surface D. Hb Bibba: substitutes a P for a L involved in an a helix E. Hb Milwaukee: substitutes a E for a V F. Hb Providence: substitutes an N for a K...
Consider the following XML file: <root> <students> <element> <ID>100345</ID> <Nationality>USA</Nationality> <Program>ICT</Program> <age>23</age> <name>John</name> </element
Consider the following XML file: <root> <students> <element> <ID>100345</ID> <Nationality>USA</Nationality> <Program>ICT</Program> <age>23</age> <name>John</name> </element> <element> <ID>100876</ID> <Nationality>MALAYSIA</Nationality> <Program>CS</Program> <age>28</age> <name>Awang</name> </element> <element> <ID>100257</ID> <Nationality>AUSTRALIA</Nationality> <age>25</age> <name>Alex</name> </element> </students> </root Write an XQUERY to display the information for all students who are not Malaysians or older than 25.
Single-Price Monopoly: Consider a single-price monopolist (i.e. the monopolist cannot price discriminate) facing the following market...
Single-Price Monopoly: Consider a single-price monopolist (i.e. the monopolist cannot price discriminate) facing the following market demand curve: P = 120 − Q. The monopolist has constant marginal cost of $20 and zero fixed cost. (a) Determine the monopolist’s profit maximizing quantity, denoted QM, and profit-maximizing price, denoted PM. (b) Determine the quantity and price that would result in the market if this instead were a competitive market, denoted QC and PC, respectively. (c) Draw a picture of the market...
consider the following data for two products of gitano manufacturing number id units produced product a...
consider the following data for two products of gitano manufacturing number id units produced product a 11,500 units product b 1300 units direct labor cost (@ $27 per DLH) product a 0.14 DLH per unit product b 0.28 DLH per unit direct materials cost product a $2 per unit product b $2.50 per unit machine setup overhead costs $51,176 materials handling $ 55,000 quality control inspections $79,380 total $ 185,556 round to two decimal places 1. use direct labor hours...
QUESTION 60 Given the following Product structure: struct Product {     string name;     double price;...
QUESTION 60 Given the following Product structure: struct Product {     string name;     double price;     int quantity;     bool equals(const Product&); }; how would you define the equals function so two products are equal if their names and prices are equal? a. bool equals(const Product& to_compare) {     return (name == to_compare.name && price == to_compare.price); } b. bool Product::equals(const Product& to_compare) {     return (name == to_compare.name || price == to_compare.price); } c. bool equals(const Product& to_compare)...
Consider the following relational database schema:             employee(employee-name, employee-id, street, e-city)             works(employee-
Consider the following relational database schema:             employee(employee-name, employee-id, street, e-city)             works(employee-id, company-id, salary)             company(company-name, company-id, c-city)             manages(employee-id, manager-id) Specify the following queries on this database schema using the relational operators we discussed in class. Write your answers on a separate sheet of paper in the order that they are specified below. Retrieve the name and address of employees who work for First Bank Corporation. Retrieve the name, street address, and city of residence of all employees...
Create a table ‘StudentInfo’ with following fields: ID First Name Last Name SSN Date of Birth...
Create a table ‘StudentInfo’ with following fields: ID First Name Last Name SSN Date of Birth Create a table ‘ClassInfo’ table: ID Class Name Class Description Create a table ‘RegisteredClasses’ table: StudentID ClassID The RegisteredClasses table should have a foreign key relationship to StudentInfo and ClassInfo tables for the respective IDs. Also the IDs in StudentInfo and ClassInfo need to be primary keys. When you submit the file your email should also contain the following SQL Queries: Query to show...
3. Consider a Monopoly with the following demand and cost structures: Price $18 $14 $12 $10...
3. Consider a Monopoly with the following demand and cost structures: Price $18 $14 $12 $10 Quantity/ Output10 60 70 80 (a) First, label the relevant graphs correctly. (2 points) (b) From the diagram what is the profit maximizing output of the monopolist? Why? (2 points) (c) From the diagram what is the price that the monopolist charges on each unit she sells. Briefly explain. (1 point) (d) Compute the Monopolist’s profit? (2 points) (e) If instead this was a...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT