SAS OnlineTutor HomeFAQ PageSuggested Learning PathsContents+Searchback||next

Quiz: Performing Queries Using SQL

Select the best answer for each question and click Score My Quiz.

  1. Which of the clauses in the PROC SQL program below is written incorrectly?
    proc sql;
       select style sqfeet bedrooms
          from choice.houses
          where sqfeet ge 800;

     a.   SELECT
     b.   FROM
     c.   WHERE
     d.   Both a and c

  2. How many statements does the program below contain?
    proc sql;
       select grapes,oranges,
              grapes + oranges as sumsales
          from sales.produce
          order by sumsales;

     a.   two
     b.   three
     c.   four
     d.   five

  3. Complete the program below to select the columns Address and SqFeet from the table List.Size and Price from the table List.Price. (Only the column Address appears in both tables.)
    proc sql;
       _____________
           from list.size,list.price;

     a.   select address,sqfeet,price
     b.   select size.address,sqfeet,price
     c.   select price.address,sqfeet,price
     d.   Either b or c

  4. Which of the clauses below correctly sorts rows by the values of the columns Price and SqFeet?

     a.   order price, sqfeet
     b.   order by price,sqfeet
     c.   sort by price sqfeet
     d.   sort price sqfeet

  5. Which clause below specifies that the two tables Produce and Hardware be queried? Both tables are located in a library assigned the libref Sales.

     a.   select sales.produce sales.hardware
     b.   from sales.produce sales.hardware
     c.   from sales.produce,sales.hardware
     d.   where sales.produce, sales.hardware

  6. Complete the SELECT clause below to create a new column named Profit by subtracting the values of the column Cost from those of the column Price.
    select fruit,cost,price,
        ________________

     a.   Profit=price-cost
     b.   price-cost as Profit
     c.   price-cost=Profit
     d.   Profit as price-cost

  7. Which of the following is false? To end the SQL procedure, you can

     a.   submit another PROC step
     b.   submit a QUIT statement
     c.   submit a RUN statement
     d.   submit a DATA step

  8. Which of the following statements is false?

     a.   The PROC SQL step does not require a RUN statement.
     b.   The PROC SQL step is made up of statements and clauses.
     c.   The order of clauses within a SQL SELECT statement does not matter.
     d.   A report is automatically generated by the PROC SQL step.

  9. Which statement is true regarding the use of the PROC SQL step to query data stored in two or more tables?

     a.   When joining multiple tables, each table must contain unique columns.
     b.   You must specify the table from which you want each column to be read.
     c.   The tables that are being joined must be from the same type of data source.
     d.   If two tables being joined contain a like-named column, you must specify the table from which you want the column to be read.

  10. Which clause in the following program is incorrect?
    proc sql;
       select lastname,firstname,address,age
       from company.employees census.demo
       where employees.id=demo.id
       group by lastname;

     a.   SELECT
     b.   FROM
     c.   WHERE
     d.   GROUP BY



back||next

Terms of Use & Legal Information | Privacy Statement