Write query for the following.employee(id,name,salary,address)department(d_id,d_name,id)(1) Create a view department_details of department table.(2) To join two existing tables using inner join.(3) To drop a view
Question
Write query for the following.employee(id,name,salary,address)department(d_id,d_name,id)(1) Create a view department_details of department table.(2) To join two existing tables using inner join.(3) To drop a view
Solution
Sure, here are the SQL queries for your requirements:
(1) To create a view department_details of department table, you can use the following query:
CREATE VIEW department_details AS SELECT * FROM department;
(2) To join two existing tables employee and department using inner join, you can use the following query:
SELECT * FROM employee
INNER JOIN department
ON employee.id = department.id;
This query will return all rows from both employee and department tables where there is a match based on the id.
(3) To drop a view department_details, you can use the following query:
DROP VIEW department_details;
This query will delete the view department_details from the database.
Similar Questions
Write a query for the following.employee(eid,name, salary, address) department(d_id, d_name, eid)Give Primary Key, foreign key constraints after creating table with constraint names in given schemas.(1) Create a view department_details of department table.(2) Join two existing tables using inner join.(3) To drop a view
The following view statements contain the name, job title and the annual salary of employees working in the department 20: (Choose the correct)Select one:a.create view DEPT20 isselect ENAME, JOB, SAL*12 ANNUAL SALARY from EMPwhere DEPTNO = 20;b.create view DEPT20 asselect ENAME, JOB, SAL*12 ANNUAL SALARY from EMPwhere DEPTNO <> 20;c.create view DEPT20 asselect ENAME, JOB, SAL*12 ANNUAL SALARY from EMPwhere DEPTNO = 20;
Write queries for the following.Employee ( EID, Name, Age, Salary)Department ( DID, D_Name, EID,Country)(1) Create a view Emp_India which contains the name, age and salary of Indianemployees.(2) Display the name of employee in descending order whose Country starts with ‘I’
Which of the following SQL statements will create a view that lists only the employees in department number 7?1 pointCREATE VIEW EMP_VIEW (EMP_ID, FIRSTNAME, LASTNAME)AS SELECT EMP_ID, F_NAME, L_NAMEFROM EMPLOYEES WHERE DEP_ID = 7;CREATE VIEW EMP_VIEW (EMP_ID, FIRSTNAME, LASTNAME)AS SELECT EMP_ID, F_NAME, L_NAMEWHERE DEP_ID = 7;CREATE VIEW EMP_VIEW (EMP_ID, FIRSTNAME, LASTNAME)AS SELECT EMP_ID, F_NAME, L_NAMEFROM EMPLOYEES IF DEP_ID = 7;CREATE VIEW EMP_VIEW (EMP_ID, FIRSTNAME, LASTNAME)WHERE DEP_ID = 7AS SELECT EMP_ID, F_NAME, L_NAMEFROM EMPLOYEES;
Which of the following SQL statements will create a view named EMP_VIEW with an employee’s First name, last name, and ID, based on the EMPLOYEES tables?1 pointCREATE VIEW EMP_VIEW (EMP_ID, FIRSTNAME, LASTNAME)AS SELECT EMP_ID, F_NAME, L_NAMEFROM EMPLOYEES; CREATE VIEW EMP_VIEW (EMP_ID, FIRSTNAME, LASTNAME)FROM EMPLOYEES; CREATE VIEW EMP_VIEW (EMP_ID, FIRSTNAME, LASTNAME)AS SELECT EMP_ID, F_NAME, L_NAME;NEW VIEW EMP_VIEW (EMP_ID, FIRSTNAME, LASTNAME)AS SELECT EMP_ID, F_NAME, L_NAMEFROM EMPLOYEES;
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.