Create View Syntax:
CREATE VIEW my_view_name AS
SELECT column_name(s)
FROM my_table_name
WHERE condition
Create View Example:
Sales table:
ID | PRICE | NAME |
---|---|---|
1 | 200 | A |
2 | 500 | B |
3 | 900 | C |
4 | 500 | D |
CREATE VIEW sales_view AS
SELECT id, price, name
FROM sales
WHERE price=500;
Create View Result:
ID | PRICE | NAME |
---|---|---|
2 | 500 | B |
4 | 500 | D |