CREATE TABLE AverageStudents
AS
(SELECT *
FROM StudentData
WHERE GPA > 3.0);
我一直收到错误
Incorrect syntax near the keyword 'AS'.
我的简单代码看起来不错吗? 我真的想要一张桌子(不是视图,不过感谢你的建议)。
答案 0 :(得分:10)
试试这个 -
SELECT *
INTO AverageStudents
FROM StudentData
WHERE GPA > 3.0
或者这个 -
CREATE VIEW AverageStudents
AS
SELECT *
FROM StudentData
WHERE GPA > 3.0
答案 1 :(得分:6)
我认为您正在寻找a view:
CREATE VIEW AverageStudents AS
SELECT *
FROM StudentData
WHERE GPA > 3.0;
答案 2 :(得分:4)
如果你真的想要一张桌子,那就试试下面的代码:
SELECT *
INTO AverageStudents
FROM StudentData
WHERE GPA > 3.0
然而,听起来像bhamby建议的观点可能更合适
答案 3 :(得分:3)
我认为bhamby是对的,但如果你真的想要一张桌子
SELECT *
INTO AverageStudents
FROM StudentData
WHERE GPA > 3.0
答案 4 :(得分:3)
我想你可能在寻找SELECT INTO