SvekkeHomie
-
Posts
4 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by SvekkeHomie
-
-
My problems with adding constraints using the Tryit editor continue ...
Adding a table with...
CREATE TABLE PersonTest(PersonID int PRIMARY KEY,Name varchar(255))
no problem, but then subsequently adding another table...
CREATE TABLE OrderTest(OrderID int PRIMARY KEY,OrderDesc varchar(255),PersonID int FOREIGN KEY REFERENCES PersonTest(PersonID))
Gives me a similar "Error 1: could not prepare statement (1 near "FOREIGN"; syntax error)".
The course content becomes hard to test this way
-
The one provided by the W3Schools site, SQL Tryit Editor v1.2.No idea what db system is behind this ?
-
I just started with SQL and thus following the online W3Schools course.
Unfortunately now stuck with adding a constraint to an already created table...
http://www.w3schools.com/sql/sql_unique.asp
After creating a table with...
CREATE TABLE MyTest(MyVar1 int,MyVar2 varchar(255))
and trying to put a unique constraint on the MyVar1 column with...
ALTER TABLE MyTestADD UNIQUE (MyVar1)
I get "Error 1: could not prepare statement (1 near "UNIQUE"; syntax error)".
Anyone ?
Add constraint problem
in SQL
Posted
That indeed probably explains my issues and why they don't put a "Try it yourself" button after these code snippets !
Uh ... W3Schools ... maybe a good idea to mention that not all code in the course can be tested with the built-in Tryit Editor ?
Losing valuable time this way