Forum

Create View Mysql: ...
 
Share:
Notifications
Clear all

Create View Mysql: Can you help me to create these views using employee table as reference?


Posts: 47
Guest
Topic starter
(@Saba Ot)
Eminent Member
Joined: 4 years ago

Create View Mysql: Query examples are given below. 

Query1:

Create a view call employee_ve based on the employee number, employee names, and department numbers from the emp table. Change the heading for the emp name to EMPLOYEE.

Query2
Display the contents of the employee_ve view

Query3
Create a view called SALARY_VE based on the employee names, salaries, and salary grades for all employees. Use the EMP and salary grade respectively

Query4
Create a view named DEPT115 that contains the emp numbers, emp names, and department numbers for all employees in department 115. Do not allow an employee to be reassigned to another department through the view.

Query5
Create an index on the department number of the Emp table. Drop the newly created index.

2 Replies
Posts: 71
Guest
(@Vikky)
Trusted Member
Joined: 4 years ago

Query2

 

First choose the view which you want to see the content or a script.

Just right click on the view area choose "script view as"  and then choose sub option called "create to" and then click on "New Query Window". 

Hope this is what you expected for this query.  

Right-click on the selected views and choose "Script View As" =>Create To => New Query Window.

Reply

Self Learning Video Tutorials - Software Course

Posts: 71
Guest
(@Vikky)
Trusted Member
Joined: 4 years ago

Query5

You can create different types of indexes based on your requirement.

Here is one simple example how you can create a index in SQL server.

Create or Replace INDEX emp_dept_index ON employee(department_number)

Thats it. Create index is very simple. 

 

Reply

Leave a reply

Author Name

Author Email

Title *

Preview 0 Revisions Saved
Share: