Create a new table using the create table command

Assignment Help Database Management System
Reference no: EM13949067

Write and execute an SQL query in SQL*Plus

A. Table Creation and Management

1.  Create a new table using the CREATE TABLE command. Use your first name and your last name for the name of the table (for instance, for John Smith the name of the table will be JOHN_SMITH). Make sure to include at least four different data types (CHAR, VARCHAR2, NUMBER, DATE) for the columns. Use the DESCRIBE command to verify that the columns have been defined correctly.

2.   Obtain the columns names and data types of the view USER_TABLES using the DESCRIBE command. Retrieve the names of all the tables of a user's database tables using the SELECT table_name FROM user_tables; command.

3.  Use the ALTER TABLE ... ADD command to add a column to the table created in Problem 1.

4.  Use the ALTER TABLE ... MODIFY command to change the size of any column in the table created in Problem 1.

5.  Use the ALTER TABLE ... DROP COLUMN command to drop a column in the table created in Problem 1.

6.  Rename the table created in Problem 1 using the RENAME ... TO command.

7.  Drop the table created in Problem 1 using the DROP TABLE command.

8. Restore the table created in Problem 1 using the FLASHBACK TABLE command.

9. Use the DROP TABLE ... PURGE command to delete your table permanently. Use the SELECT object_name, original_name FROM recyclebin; command to confirm that the table is not in the recycle bin anymore.

B.  Constraints:

1. Write an SQL code to create the STUDENT table. The information about the STUDENT table is provided below. When creating the table, make sure to include appropriate constraints defined in the description.

Attribute

Data Type

Constraints

ST_NUMBER

NUMBER(6)

Primary Key

ST_LAST

VARCHAR2(35)

NOT NULL

ST_FIRST

VARCHAR2(25)

 

ST_DOB

DATE

 

 

 

 

 

2. Write an SQL code to create the VENDOR table. The information about the VENDOR table is provided below. When creating the table, make sure to include appropriate constraints defined in the description.

Attribute

Data Type

Constraints

VEND_NUMBER

NUMBER(5)

Primary Key

VEND_NAME

VARCHAR2(35)

NOT NULL

3. Write an SQL code to create the PRODUCT table. The information about the PRODUCT table is provided below. When creating the table, make sure to include appropriate constraints defined in the description.

Attribute

Data Type

Constraints

PROD_CODE

NUMBER(5)

Primary Key

PROD_DESC

VARCHAR2(35)

 

4. Assuming that each product is manufactured by many vendors and each vendor makes many products, create a bridge table between VENDOR and PRODUCT. When creating the table, make sure to include appropriate constraints (primary key, foreign keys, etc.).

5. Use the ALTER TABLE ... ADD CONSTRAINT command to add the UNIQUE constraint to the PROD_DESC column in the PRODUCT table.

6. Use the ALTER TABLE ... ADD CONSTRAINT command to add the CHECK constraint to the ST_DOB column to verify that all dates of birth are before 01/01/2000.

Reference no: EM13949067

Questions Cloud

Construct a scatterplot for these 10 values by hand : When two variables are correlated (such as strength and running speed), it also means that they are associated with one another. But if they are associated with one another, then why doesn't one cause the other?
What is the bond yield to maturity : Bonds of Riverhawk Sport Authority (RSA) are selling in the market for $957.10. These bonds carry a 9.50 percent coupon paid semiannually, and have 20 years remaining to maturity. What is the bond’s yield to maturity?
Bond outstanding with market price-coupon rate : Riverhawk Corporation has a bond outstanding with a market price of $1,250.00. The bond has 10 years to maturity, pays interest semiannually, and has a yield to maturity of 9%. What is the bond’s coupon rate?
Who purchased them at the going out of business sale : If TV Manufacturer has not been paid for the TV sets, would it have the legal right to recover them from individual customers who purchased them at the going-out-of-business sale?
Create a new table using the create table command : Obtain the columns names and data types of the view USER_TABLES using the DESCRIBE command. Retrieve the names of all the tables of a user's database tables using the SELECT table_name FROM user_tables; command.
Design a combinational logic circuit : 1. Design a combinational logic circuit which will add two 4-bit binary numbers. 2. Minimize the expression described in the truth table of Figure P12.50, and draw the circuit.
Rate of return on investments in this risk class : Riverhawk Sport Authority (RSA) will pay a dividend of $7 for each of the next 3 years, $8 for each of the years 4-6, $9 for each of the years 7-9, and a dividend of $10 for year 10. Thereafter, the company will pay no dividends. If you require 11 pe..
Faced conflicts of interest within our workplace : Conflicts of interest arise in all organizations. This module shows that no organization, whether public or private, is exempt from issues related to conflicts of interest. Conflicts of interest result in being pulled in two different directions. ..
Importance and significance of these processes : What has been the importance and significance of these processes and their cyclic interaction to the evolution and diversity of life?

Reviews

Write a Review

Database Management System Questions & Answers

  An electronic logic gate whose output is logic 0

An electronic logic gate whose output is logic 0 only when all inputs are logic 1

  Explain which transaction satisfy two-phase locking protocol

Please briefly explain whether the following schedule has a deadlock. Your grade depends on both your answer and explanation and please briefly explain which transactions satisfy two-phase locking protocol and which don't.

  Explain the benefits of normalization

Explain one characteristic of a database that has data redundancy and Briefly explain the benefits of normalization and why we should implement it when designing databases

  Convert excel files into an access database

The Morris Arboretum tracks donors to their organization in Microsoft Excel. Access for future Arboretum records. In the following project, you convert Excel files into an Access database for Morris Arboretum

  What are functional dependencies

Multi-level index is guaranteed to have the search cost proportional to the number of levels inmulti-level index.

  Use cases perform a requirements analysis for the case study

Use Cases Perform a requirements analysis for the Case Study

  Estimate a bernoulli naive bayes classifer

Estimate a Bernoulli Naive Bayes classifer and apply the classifier to the test document - You are asked to perform group average hierarchical clustering on this dataset.

  Compose conceptual data modeling techniques

Prepare database design documents using the data definition, data manipulation, and data control language components of the SQL language.

  Sketch hash table to result from using hash function

Sketch hash table of length 11 which results from using hash function h(i) = (2i + 5) mod 11, to hash the keys 12, 44, 13, 88, 23, 94, 11, and 39,

  Explaining views for protecting access by unauthorized users

Why do you believe that views by themselves are insufficient for protecting access by unauthorized users?

  First-stage allocation to the customer support

Would be allocated in the first-stage allocation to the Customer Support activity cost pool - Allocated in the first-stage allocation to the Order Size activity cost pool -

  Companys traditional costing system

The manufacturing overhead that would be applied to a unit of product R58G under the company's traditional costing system is closest

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd