Question

In: Computer Science

IN SQL Create a table called product containing a product no, company name, model_no,product name. What...

IN SQL
Create a table called product containing a product no, company name, model_no,product name. What is my primary key? Which datatypes should I use?Pleasesubmit a printout of the commands used for creating the above table and the resultsof your queries/commands

Solutions

Expert Solution

Answer:

Query:
Create table Product(
ProductNo number,
CompanyName varchar2(25),
ModelNo varchar2(10),
ProductName varchar2(25),
Primary Key(ProductNo));

Output:
Table has been created.

Result:
Product table will be created with columns ProductNo, CompanyName, ModelNo, and ProductName

Explanation:
ProductNo is a number so the data type is number.
CompanyName is a string so the data type is varchar2
ModelNo is the combination of numbers and letters so it's data type is varchar2
ProductName is a string so the data type is varchar2.
ProductNo holds unique values so it is the Primary key.

Thanks and All the best. Let me know in case if you have any doubts.


Related Solutions

write a sql statement that retrieves product ID (ProductID) and name (Name) from Production.product table for...
write a sql statement that retrieves product ID (ProductID) and name (Name) from Production.product table for all product whose name includes both the words "silver" and "frame"
Using SQL create a new database called school_app. Create a student table with fields id (auto...
Using SQL create a new database called school_app. Create a student table with fields id (auto increment), first_name, last_name. Create a course table with fields id (auto increment), course code (such as ITC or MTH), and course number (such as 100 or 295). Note that the relationship between student and course is many-to-many (n:m). Create a join table called student_course that implements the n:m relationship with fields id (auto increment), student_id, course_id, and grade (which has values 0, 1, 2,...
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)...
(SQL Coding) Create a view based on the Job History table. Name the view: view_job_history. Select...
(SQL Coding) Create a view based on the Job History table. Name the view: view_job_history. Select all columns to be included in the view. Add a WHERE clause to restrict the employee_id to be greater than 150. Add the WITH READ ONLY option. Show me the code used to create the view and the results of a select statement on the view.
DBMS Create/Insert/Update SQL I need the create, insert, and update SQL statement for this table as...
DBMS Create/Insert/Update SQL I need the create, insert, and update SQL statement for this table as if it were being added to MySQL (please give explanations for each line of SQL code and a copy of the code as it would be entered into the query by itself: Customer PK Customer ID Text Phone Number int name text address ID int email text FK vendor ID int Vendor is the name of the table the FK comes from.
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...
DBMS Create/Insert/Update SQL I need the create, insert, and update SQL statement for this table: Customer...
DBMS Create/Insert/Update SQL I need the create, insert, and update SQL statement for this table: Customer PK Customer ID Text Phone Number int name text address ID int email text FK vendor ID int Vendor is the name of the table the FK comes from.
In a Package called characterArray, ********JAVA CODE********** 1) Create a char array containing your full name...
In a Package called characterArray, ********JAVA CODE********** 1) Create a char array containing your full name and print it out. 2) Create an uninitialized char array and copy into it      the char array containing your full name and print it out. 3) Create a Character array and copy into it the char array containing      your full name and print it out. 4) Into the Character array, use toUpperCase() to copy the char array containing     your full name...
Create a table in SQL with foreign key reference: 1.Create the three tables without any columns...
Create a table in SQL with foreign key reference: 1.Create the three tables without any columns 2.Alter the tables to add the columns 3.Alter the tables to create the primary and foreign keys
Create a ‘Student’ table using SQL query. The table must have at least five attributes from...
Create a ‘Student’ table using SQL query. The table must have at least five attributes from your choice with different data types.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT