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 chmod command would you use to impose the following permissions? 1. on a directory(called dir1)...
What chmod command would you use to impose the following permissions? 1. on a directory(called dir1) and all its subdirectories such that: the owner would have read, write, and execute; the group would have read and execute; and others would have read(write the command in two ways: using rwx and using numeric value) 2. on file (called file1)such that: the owner would have read and write; the group would have no permissions; and others would have write (write the command...
What does it mean to make user classes in SQL?
What does it mean to make user classes in SQL?
do the following SQL programming tasks: Use the CREATE TABLE statement to build the sample table...
do the following SQL programming tasks: Use the CREATE TABLE statement to build the sample table (MODULE) Use the INSERT INTO statement to populate it - use either the data in the image or your own Write an SQL query to display the whole populated table Write an SQL query to display certain combinations of columns (use your imagination) Write an SQL query to extract certain combinations of columns and rows (imagination again!)
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...
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