Question
1. Create a table COPYOFDEPT as a copy of the table DEPT. syntax: CREATE TABLE new_table SELECT * FROM original_table; 2. Delete all the rows
1. Create a table COPYOFDEPT as a copy of the table DEPT.
syntax: CREATE TABLE new_table SELECT * FROM original_table;
2. Delete all the rows from COPYOF DEPT table.
syntax: DELETE FROM table_name;
3. Remove COPYOF DEPT table.
Syntax: DROP TABLE table_name;
4. Drop Foreign key defined on SuperSSN and add it using Alter table command.
Syntax: To drop foreign keys using the command line, enter: ALTER TABLE name DROP FOREIGN KEY foreign_key_name.
5. Add Foreign Keys to DEPT table (to any column ) using Alter Table .
Syntax: Add Foreign key to the Existing Table. If you want to add the foreign key to the existing table, you have to use the following ALTER syntax in
SQL: ALTER TABLE Table_Name1 ADD CONSTRAINT ForeignKey_Name FOREIGN KEY (Column_Name) REFERENCES Table_Name2 (Column_Name);
6. Find the employee names having salary greater than Rs.25000.
SELECT emp_name FROM employee WHERE emp_salary>=25000;
7. Find the employee names whose salary lies in the range between 30000 and 70000.
Sample Solution: SELECT * FROM employees WHERE salary BETWEEN 1000 and 3000; or SELECT * FROM employees WHERE salary BETWEEN (SELECT 1000) AND 3000;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started