0

For example, in SAS's PROC SQL, there are two ways to insert new rows to a table: INSERT is a statement but VALUES is a clause. So if they are different, what is the purpose of knowing the difference between a statement and a clause?

Gemini
  • 1

2 Answers2

3

A clause is part of a statement.

INSERT statement

The INSERT statement can take more than one form:

INSERT INTO table SELECT a,b FROM table1;

INSERT INTO table VALUES ('test',100);

The first statement has a SELECT clause, the second employs a VALUES clause.

SELECT statement

SELECT is another form of PROC SQL statement, but this can contain a number of clauses:

  • SELECT
  • FROM
  • WHERE
  • GROUP BY
  • HAVING
  • ORDER BY

CASE expression

Another place where clauses are used is in a CASE expression, which contains a number of WHEN-THEN clauses.

mjsqu
  • 5,151
  • 1
  • 17
  • 21
0

Specifically for VALUES and SELECT clause in INSERT statement see How to use select statement in a value statement . VALUES provides a possibility to insert constants (only constants).

Community
  • 1
  • 1
vasja
  • 4,732
  • 13
  • 15