Question

In: Computer Science

- What SQL command would you use to make a table for products that includes three...

- What SQL command would you use to make a table for products that includes three columns: a product’s ID, a product’s cost, and a product’s selling price?

- What SQL command would you use to make a table for telephone directory that contains a person’s full name, a person’s cellphone number, and a person’s home phone number?

- What SQL command would you use to make a table for an inventory of network equipment that includes the following: the device name, the physical location, the device’s primary IP address, and date of purchase?

Solutions

Expert Solution

1. To make Products Table: ID is numeric and cost ans selling price are float. ID is primary key because a product can be uniquely identified by ID.

CREATE TABLE Products (
    ProductID int PRIMARY KEY,
    Cost float,
    SellingPrice float
);

2. To make Telephone Directory Table: Name is string whose length we have set to be maximum 50. Cell phone and home phone numbers would be int of length 10. Name is Primary Key because we use name to find a row in a telephone directory. (** You can change the lengths according to your choice**)

CREATE TABLE TelephoneDirectory (
    Name varchar(50) PRIMARY KEY,
    CellPhone int(10),
HomePhone int(10)
);

3. To make Inventory Table: Device Name is string whose length we have set to be maximum 50. Location and IPAddress would be string of length maximum 30. Purchase date is of data type:date. (** You can change the lengths according to your choice**)

CREATE TABLE Inventory (
    Name varchar(50),
    Location varchar(30),
    IPAddress varchar(30),
    PurchaseDate date
);


Related Solutions

Write an SQL command that creates a SHOP table. The table should have a shop_id, a shop_name, a shop_location
Write an SQL command that creates a SHOP table. The table should have a shop_id, a shop_name, a shop_location
Use a single SQL statement to create a relational table and to load into the table...
Use a single SQL statement to create a relational table and to load into the table department name, subject code, year of running and session of running that offered by the departments. Note that a running subject offered by a department means a lecturer of the department has been assigned to teach the subject. Next, enforce the appropriate consistency constraints on the new table.    When ready use SELECT statement to list the contents of the relational table created and...
How would you define non-verbal communication? Make sure that your answer includes the three types of...
How would you define non-verbal communication? Make sure that your answer includes the three types of non-verbal communication and that you give concrete examples for each type, also citing examples in non-western societies those forms of non-verbal communication, which are culturally specific to those societies.
defend three specific methods you would use to make the typical arbitration procedure more effective. What...
defend three specific methods you would use to make the typical arbitration procedure more effective. What are the advantages to your suggested procedures?
What does it mean to make user classes in SQL?
What does it mean to make user classes in SQL?
What is the difference between IP and MAC address on a PC? What command would you...
What is the difference between IP and MAC address on a PC? What command would you type that will give you both IP and MAC information.
1. In terms of security, why would you not use rm command to delete files? 2....
1. In terms of security, why would you not use rm command to delete files? 2. Shred and dd are tools used to securely delete files. Which is the best tool for securely deleting a file from a system and why? Consider the limitations of each tool when choosing your answer. 3. What encryption is used to encrypt HTTP traffic (HTTPS)? 4. The CIA triad , confidentiality, integrity, and availability represent the three goals for cybersecurity. Which goal(s) does/do encryption...
1. Use SQL to create a polyinstantiated table including a primary key and a unique constraint...
1. Use SQL to create a polyinstantiated table including a primary key and a unique constraint 2.Use SQL to insert multiple records for each security classification with the same ID. You must have 4 classifications. 3.Use SQL to create 4 schemas, one for each security classification 4.Use SQL to create a view in each schema that restricts the records to those belonging to a particular security classification and restricts the columns to only those columns that have relevant data. 5.Select...
USE SQL CREATE TABLE IF NOT EXISTS football_games ( visitor_name VARCHAR(30),       /* Name of the visiting...
USE SQL CREATE TABLE IF NOT EXISTS football_games ( visitor_name VARCHAR(30),       /* Name of the visiting team                     */ home_score SMALLINT NOT NULL,   /* Final score of the game for the Buffs         */ visitor_score SMALLINT NOT NULL,/* Final score of the game for the visiting team */ game_date DATE NOT NULL,        /* Date of the game                              */ players INT[] NOT NULL,         /* This array consists of the football player ids (basically a foreign key to the football_player.id) */ PRIMARY KEY(visitor_name, game_date)...
What are CBRNE attacks and what would be their impact? use a table to answer this...
What are CBRNE attacks and what would be their impact? use a table to answer this question.)
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT