Creating a table and a view with the select statement.

In this article, you’ll learn how to create a view and table based on a select statement.

-~ To create a view
CREATE VIEW Emp_View 
AS
SELECT Ename, DName FROM Emp
INNER JOIN Dept ON Emp.DeptNo = Dept.DeptNo;

-~ To create a table
CREATE TABLE EmpDept 
AS 
SELECT Ename, DName FROM Emp
INNER JOIN Dept ON Emp.DeptNo = Dept.DeptNo;


Can we create a table based on a view? Click here.

2 comments

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s