# Oracle Quiz #2

Problem #1: Show the results of the query below and explain your answer.
Data in the table bldgofc:
```BLDG                 OFFICE
-------------------- ------
K Building           #112
K Bldg               115
H                    #114

SQL> SELECT SUBSTR(bldg,1,1)||SUBSTR(office,-3,3)
2 FROM bldgofc;
```
Problem #2: Show the results of the query below and explain your answer.
Data in the table ofbl:
```BLDGOFC
--------------------
Building K #112
#115 K
Office K#114

SQL>  SELECT SUBSTR(bldgofc,instr(bldgofc,'#')+1,3)
2 FROM ofbl;
```
```Data in the table donor:
IDNO  NAME            STADR           CITY       ST ZIP   DATEFST      YRGOAL CONTACT
----- --------------- --------------- ---------- -- ----- --------- --------- -----------
11111 Stephen Daniels 123 Elm St      Seekonk    MA 02345 03-JUL-98       500 John Smith
12121 Jennifer Ames   24 Benefit St   Providence RI 02045 24-MAY-97       400 Susan Jones
22222 Carl Hersey     24 Benefit St   Providence RI 02045 03-JAN-98           Susan Jones
23456 Susan Ash       21 Main St      Fall River MA 02720 04-MAR-92       100 Amy Costa
33333 Nancy Taylor    26 Oak St       Fall River MA 02720 04-MAR-92        50 John Adams
34567 Robert Brooks   36 Pine St      Fall River MA 02720 04-APR-98        50 Amy Costa
Problem #3:  Show the results of the query below and explain your answer. Use the donor table.
SQL> SELECT SUBSTR(contact,ROUND(MOD(yrgoal,7),0),5)
2  FROM donor;

Problem #4:  Show the results of the query below and explain your answer. Use the donor table.
SQL> select contact, count(*)
2  from donor
3  group by contact
4  order by contact;

Problem #5:  Show the results of the query below and explain your answer. Use the donor table.
SQL> select state, count(*)
2  from donor
3  where datefst !='04-MAR-92'
4  group by state
5  having state = 'MA';

```