I AM ONLY NEEDING THE SQL QUERY Create a new table using the

I AM ONLY NEEDING THE SQL QUERY.

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 Erik Morataya the name of the table will be Erik_Morataya). Make sure to include at least four different data types (CHAR, VARCHAR2, NUMBER, DATE) for the columns. When creating the table, make sure to include appropriate constraints (primary key, foreign keys, etc.).Use the DESCRIBE command to verify that the columns have been defined correctly.

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. Explain in a complete, coherent sentence what the result means.

Use the ALTER TABLE … ADD command to add a column to the table created in Problem 1. Use the ALTER TABLE … MODIFY command to change the size of any column in the table created in Problem 1.

Use the ALTER TABLE … ADD CONSTRAINT command to add a new constraint (UNIQUE, CHECK, etc.) to any column in the table created in Problem 1.

Use the ALTER TABLE … DROP COLUMN command to drop a column in the table created in Problem 1. Rename the table created in Problem 1 using the RENAME … TO command. Drop the table created in Problem 1 using the DROP TABLE command. Restore the table created in Problem 1 using the FLASHBACK TABLE command.

Solution

Hi PFB all the SQL Queries

CREATE TABLE fname_lname
( employee_number int NOT NULL,
employee_name char(50) NOT NULL,
department_id int,
salary int,
address varchar2(50),
CONSTRAINT employees_pk PRIMARY KEY (employee_number),
CONSTRAINT fk_departments
FOREIGN KEY (department_id)
REFERENCES departments(department_id)
);

Select employee_name from fname_lname where employee_number =101;

Select employee_number, employee_name from fname_lname where salary > 20000;

ALTER TABLE fname_lname ADD city varchar(20);

ALTER TABLE fname_lname MODIFY city varchar(25);

ALTER TABLE fname_lname MODIFY department_id int NOT NULL;

ALTER TABLE fname_lname DROP COLUMN department_id;

Rename table fname_lname to fname_lname_record;

Drop table fname_lname_record;

I AM ONLY NEEDING THE SQL QUERY. Create a new table using the CREATE TABLE command. Use your first name and your last name for the name of the table (for instan

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site