1.7 Flashcards
True/False - At a minimum, an SQL query must specify a list of column names to retrieve in the SELECT clause and the name of the table that contains the columns in the FROM clause.
True
Which of the following is false regarding the SQL statement below?
proc sql;
select Name, Age, Height, Birthdate format=date9.
from pg1.class_birthdate;
quit;
a) This query selects columns from the pg1.class_birthdate table and generates a report.
b) The SELECT clause specifies the columns that you want to appear in the result.
c) Column names are always separated with commas.
d) The format applied to Birthdate is part of standard SQL syntax.
d) The format applied to Birthdate is not standard SQL syntax, this SAS extension to the SQL language makes it easier to create more useful and polished reports.
In PROC SQL, which clause do you use to sort the report that is produced?
a) WHERE
b) BY
c) SORT
d) ORDER BY
d) ORDER BY
If you want to order the rows in descending order, you would add the DESC keyword after the column name in the ORDER BY clause.
Which of the following SQL procedures will generate a table instead of a report?
a) proc sql; create table myclass as select Name, Age, Height from pg1.class_birthdate where age > 14 order by Height desc; quit;
b) proc sql; create table myclass as; select Name, Age, Height from pg1.class_birthdate where age > 14 order by Height desc; quit;
c) proc sql; select Name, Age, Height from pg1.class_birthdate where age > 14 order by Height desc; quit;
a) proc sql; create table myclass as select Name, Age, Height from pg1.class_birthdate where age > 14 order by Height desc; quit;
Which of the following will drop a table?
a) ODS drop table work.myclass;
b) options drop table work.myclass;
c) proc sql;
drop table work.myclass;
quit;
d) proc sql;
delete table work.myclass;
quit;
c) proc sql;
drop table work.myclass;
quit;
True/False - An inner join creates a new report or table that includes only the records found in both tables.
True
Which of the following is correct syntax for an inner join?
a) FROM table1 INNER JOIN table2
ON table1.column=table2.column
b) FROM table1 INNER JOIN table2
ON column1=column2
c) FROM table1
INNER JOIN table2 table1.column=table2.column
a) FROM table1 INNER JOIN table2
ON table1.column=table2.column
What keyword is needed when assigning an alias to a table?
a) ALIAS
b) AS
c) IS
d) No keyword is necessary
b) AS
When comparing SQL to the SAS DATA step, which of the following is NOT true?
a) SQL is an ANSI-standard language used by most databases
b) code can be more streamlined
c) can manipulate, summarize, and sort data in one step
d) SQL provides more control of reading, writing, and manipulating data
d) The DATA step provides more control of reading, writing, and manipulating data than SQL
True/False - You can use SQL for looping and array processing.
False - This is possible with the SAS DATA step.
True/False - You cannot produce multiple output tables in one SQL query.
True - This is possible with the SAS DATA step.
What is the correct order of the following four clauses?
a) from…select…where…order by…
b) order by…. from…select…where…
c) select…where…order by…from…
d) select…from…where…order by…
d) select…from…where…order by…
Which of the following is false regarding the SQL procedure?
a) Column names are separated with commas.
b) The procedure ends with a QUIT statement.
c) Formats can be specified in the FROM clause.
d) The SELECT and FROM clauses are required in the SELECT statement.
c) Formats can be specified in the FROM clause.
Which syntax is valid for creating a computed column in the SELECT clause?
a) Ratio = Height/Weight
b) Ratio as Height/Weight
c) Height/Weight = Ratio
d) Height/Weight as Ratio
d) Height/Weight as Ratio
The SELECT statement creates a report. Which clause can be added before the SELECT clause to create a table?
a) create work.new =
b) create work.new table
c) create table work.new as
d) create table=work.new as
c) create table work.new as