web5498
web5498

Reputation: 3

Why am i getting an error when creating a view

i know this is simple but im just having a brain fart. Mysql creating a vew from an export script

ERROR You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'longtext ,`Community` longtext ,`Lot` longtext ,`Address` longtext ,`City` longt' at line 2

sql :

CREATE VIEW `Builder_Findings_1_2` (
`Builder` longtext
,`Community` longtext
,`Lot` longtext
,`Address` longtext
,`City` longtext
,`State` longtext
,`Zip` longtext
,`Requested QA Date` longtext
,`Inspection Type` longtext
,`Area` longtext
,`Component` longtext
,`Item Description` longtext
,`Trade` longtext
,`Notes` longtext
,`ID` longtext
);

Upvotes: 0

Views: 49

Answers (1)

z4cco
z4cco

Reputation: 107

In fact, a view is a virtual table based on the result-set of an SQL statement.

Thus, to create a view in MySQL, you have to use the following syntax :

CREATE VIEW Builder_Findings_1_2 AS
SELECT column1, column2, ...
FROM table_name
WHERE condition;

Upvotes: 1

Related Questions