Thursday, May 28, 2009

Lesson 5/28/09

1. Students who are finishing DB continue to make corrections.

2. SQL Review: Review the following webisite:

http://sqlcourse.com/intro.html

Do practice tutorial through http://sqlcourse.com/select.html , which is page three of the tutorial and stop.

Questions to answers:

1. What does the select statement do?
2. When extracting data from a table what must the strings be enclosed with?
3. What is the word from used for?
4. What clause specifies the criteria you will use to extract specific information?


From the following table, write SQL statements:

FRUIT TABLE

Item No: Fruit Price Quantity
1 Plums 1.00 100
2 Apples 2.00 200
3 Oranges 3.00 300
4 Grapes 1.00 300
5 Kiwi 7.00 100


a. List all fruit whose price is less than 3.00
b. List all fruit whose quantity is equal to 300 units.
c. List all fruit for whose price is not equal to 1.00
d. List all fruit where quanitity is leass than 300

Post answers in a comment to this post with your name.

17 comments:

  1. 1. What does the select statement do? Issues an SQL command to fetch data from a table in a database.
    2. When extracting data from a table what must the strings be enclosed with? A single quotation.
    3. What is the word from used for? To show which table in the database to extract the data from.
    4. What clause specifies the criteria you will use to extract specific information? Where

    a. List all fruit whose price is less than 3.00 - Plums, apples, and grapes.
    b. List all fruit whose quantity is equal to 300 units. oranges and grapes
    c. List all fruit for whose price is not equal to 1.00. appkes oranges grapes.
    d. List all fruit where quanitity is leass than 300. plums apples kiwi

    ReplyDelete
  2. 1.select first,
    age
    from empinfo;

    2.select first,
    last, city
    from empinfo
    where city <> 'Payson'

    3.select * from empinfo
    where age > 40

    4.select first, last from empinfo
    where last LIKE '%ay'

    5.select * from empinfo
    where first = 'Mary';


    6.select * from empinfo
    where first LIKE '%Mary%'


    1..statement is used to query the database and retrieve selected data that match the criteria that you specify.
    2.Strings must be in single quotes
    3.IOt states witch table you are extracting data from
    4.Where
    a.select price, item number, fruit, quanity from fruit table
    where price < 3.00;

    B.select price, item number, fruit, quanity from fruit table
    where quanity = 300;

    c. select price, item number, fruit, quanity from fruit table
    where pirce <> 1.00;

    D. select price, item number, fruit, quanity from fruit table
    where quanity > 300;

    ReplyDelete
  3. 1.fetches data from a table
    2. ''
    3. to show where to extract the data from
    4. where
    a.select * from FRUIT TABLE
    where price < '3.00'
    b.select * from FRUIT TABLE
    where quantity = '300'
    c.select * from FRUIT TABLE
    where price <> '1.00'
    d.select * from FRUIT TABLE
    where quantity < '300

    ReplyDelete
  4. 1. What does the select statement do?

    fetches information in a database as a SQL command.

    2. When extracting data from a table what must the strings be enclosed with?

    they are closed with quotations.

    3. What is the word from used for?

    to show the table that the data came from.

    4. What clause specifies the criteria you will use to extract specific information?
    "Where"

    a. List all fruit whose price is less than 3.00 where price < 3.00

    b. List all fruit whose quantity is equal to 3.00 units. where price = 3.00

    c. List all fruit for whose price is not equal to 1.00. where price <> 1.00

    d. List all fruit where quanitity is less than 300.
    where quantity <"300"

    ReplyDelete
  5. 1. What does the select statement do? statement is used to query the database and retrieve selected data that match the criteria that you specify.
    2. When extracting data from a table what must the strings be enclosed with? A single quotation.
    3. What is the word from used for? IOt states witch table you are extracting data from
    4. What clause specifies the criteria you will use to extract specific information? Where

    a.select * from FRUIT TABLE
    where price < '3.00'
    b.select * from FRUIT TABLE
    where quantity = '300'
    c.select * from FRUIT TABLE
    where price <> '1.00'
    d.select * from FRUIT TABLE
    where quantity < '300

    ReplyDelete
  6. 1. Grabs information in a datebase as a SQL command

    2. They must be quoted

    3. To show the table the data came from

    4. The "Where" clause

    a. <3

    b. =3

    c. <>1

    d. <3

    ReplyDelete
  7. 1. What does the select statement do?
    * The select statement is used to query the database and retrieve selected data that match the criteria that you specify.

    2. When extracting data from a table what must the strings be enclosed with?
    * Quotations.

    3. What is the word from used for?
    * To show which table in the database to extract the data from.

    4. What clause specifies the criteria you will use to extract specific information?
    * A Where Clause

    A) select * from FRUIT TABLE
    where price < '3.00'
    B) select * from FRUIT TABLE
    where quantity = '300'
    C) select * from FRUIT TABLE
    where price <> '1.00'
    D) select * from FRUIT TABLE
    where quantity < '300

    ReplyDelete
  8. 1. Select statement is used to pick and choose data from the database.
    2. Single quotation
    3. From is used to select a table.
    4. like

    A. select * from fruit table
    where price < 3.00

    B. select * from fruit table
    where quantity = 300

    C. select * from fruit table
    where price <> 1.00

    D. select * from fruit table
    where quantity < 300

    ReplyDelete
  9. 1. What does the select statement do?

    It retrieves information in a database as a SQL command.

    2. When extracting data from a table what must the strings be enclosed with?

    A quotation.

    3.What is the word used for?

    To show the table where the data originated
    from.

    4. What clause specifies the critieria you will use to extract specific information?

    Where



    a. List all fruit whosep rice is less than 3.00

    "Where Price < 3.00"

    b. List all fruit whose quantity is equal to 3 units.

    "Where Price = 3.00"

    C. List all fruit for whose prices is not equal to 1.

    "Where price <> 1"

    D. list all fruit where quantity is less than 300.

    "Where quantity < 300"

    ReplyDelete
  10. 1. What does the select statement do?
    Fetches information in a database as a SQL command.

    2. When extracting data from a table what must the strings be enclosed with?
    A single quotation.

    3. What is the word from used for?
    To show the table that the data came from.

    4. What clause specifies the criteria you will use to extract specific information?
    Where

    a. List all fruit whose price is less than 3.00
    Where price is < 3.00

    b. List all fruit whose quantity is equal to 300 units.
    Where price = 3.00

    c. List all fruit for whose price is not equal to 1.00
    Where price <> 1.00

    d. List all fruit where quanitity is leass than 300
    Where quantity <"300"

    ReplyDelete
  11. 1. What does the select statement do?
    Retrieves data from the database

    2. When extracting data from a table what must the strings be enclosed with?
    ""

    3. What is the word from used for?
    To show which table the data is from

    4. What clause specifies the criteria you will use to extract specific information?
    Where

    a.
    select * from FRUIT TABLE
    where price < "3.00"

    b.
    select * from FRUIT TABLE
    where quantity = "300"

    c.
    select * from FRUIT TABLE
    where price <> "1.00"

    d.
    select * from FRUIT TABLE
    where quantity < "300"

    ReplyDelete
  12. This comment has been removed by the author.

    ReplyDelete
  13. 1. What does the select statement do?
    Retrieves information in a database as an SQL command.

    2. When extracting data from a table what must the strings be enclosed with?
    Quotation marks.

    3. What is the word from used for?
    To show where the data was retrieved from.

    4. What clause specifies the criteria you will use to extract specific information?
    Where

    a. List all fruit whose price is less than 3.00
    Where price is < "3.00"

    b. List all fruit whose quantity is equal to 300 units.
    Where quantity = "300"

    c. List all fruit for whose price is not equal to 1.00
    Where price <> "1.00"

    d. List all fruit where quantity is less than 300
    Where quantity < "300"

    ReplyDelete
  14. NESTOR MAYSONET
    ***********************************************

    1. Select statement extracts data from the database, a.k.a. a query.

    2. When extracting data from a table the statements must be enclosed by single quotes.

    3. From is used to specify the database table from which to extract data from.

    4. LIKE and "where" are used to specify criteria for the SQL query. LIKE is the most specific.

    a.
    select "Fruit"
    from "FRUIT TABLE"
    where "Price < 3.00"

    b.
    select "Fruit"
    from "FRUIT TABLE"
    where "Quantity = 300"

    c.

    select "Fruit"
    from "FRUIT TABLE"
    where "Price <> 1.00"

    d.

    select "Fruit"
    from "FRUIT TABLE"
    where "Quantity < 300"

    ReplyDelete
  15. 1. Fetches data from a table
    2. ‘ ‘
    3. To show which table in the database to extract the data from.
    4. Where

    a.select * from FRUIT TABLE
    where price < '3.00'
    b.select * from FRUIT TABLE
    where quantity = '300'
    c.select * from FRUIT TABLE
    where price <> '1.00'
    d.select * from FRUIT TABLE
    where quantity < '300

    ReplyDelete
  16. Issues an SQL command to fetch data from a table in a database.

    A single quotation.

    To show which table in the database to extract the data from.

    Where

    Plums, apples, and grapes.

    Oranges and grapes.

    Apples, oranges and grapes.

    Plums, apples and kiwi

    ReplyDelete
  17. 1) It gets the information from the database
    2)Single Quotation marks
    3)It shows where the information was taken from
    4)Where

    A) Select "fruit" from "fruit table"
    where price < '3.00'

    B) Select "fruit" from "fruit table"
    where quantity = '300'

    C) Select "fruit" from "fruit table"
    where price <> '1.00'

    D) Select "fruit" from "fruit table"
    where quantity < '300

    ReplyDelete