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

  Knowledge and data warehousing

Design a dimensional model for analysing Purchases for Adventure Works Cycles and implement it as cubes using SQL Server Analysis Services. The AdventureWorks OLTP sample database is the data source for you BI analysis.

  Design a database schema

Design a Database schema

  Entity-relationship diagram

Create an entity-relationship diagram and design accompanying table layout using sound relational modeling practices and concepts.

  Implement a database of courses and students for a school

Implement a database of courses and students for a school.

  Prepare the e-r diagram for the movie database

Energy in the home, personal energy use and home energy efficiency and Efficient use of ‘waste' heat and renewable heat sources

  Design relation schemas for the entire database

Design relation schemas for the entire database.

  Prepare the relational schema for database

Prepare the relational schema for database

  Data modeling and normalization

Data Modeling and Normalization

  Use cases perform a requirements analysis for the case study

Use Cases Perform a requirements analysis for the Case Study

  Knowledge and data warehousing

Knowledge and Data Warehousing

  Stack and queue data structure

Identify and explain the differences between a stack and a queue data structure

  Practice on topic of normalization

Practice on topic of Normalization

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