sql assignment

1
SQL Assignment Table: Customers FirstName LastName Email DOB Phone John Smith [email protected] 2/4/1968 626 222-2222 Steven Goldfish [email protected] 4/4/1974 323 455-4545 Paula Brown [email protected] 5/24/1978 416 323-3232 James Smith [email protected] 10/20/1980 416 323-8888 SQL Commands: 1. Apply SELECT statement arbitrarily to select data from the above database table. 2. Apply SQL DISTINCT clause with the SELECT statement to return Last name and Phone numbers from the above database table. 3. Apply SQL WHERE clause to select customers conditionally (for example customers having last name “Smith”. 4. Repeat item 3 to select customers who are younger than 40 years old. 5. Add the following individual to the above table using an SQL statement: Peter Hunt, [email protected], 1/1/1974, 626-888-7777. 6. Modify the Steven Goldfish’s date of birth to 5/10/1974. 7. Remove James Smith from the above database table. 8. Reorder the above database table based on the customers’ age from youngest to oldest. 9. Apply SQL AND clause to select James Smith. 10. Apply SQL OR clause to select all customers having First Name “James” or ‘Paula”.

Upload: mahesh-dasari

Post on 08-Nov-2015

16 views

Category:

Documents


0 download

DESCRIPTION

SQL

TRANSCRIPT

  • SQL Assignment

    Table: Customers

    FirstName LastName Email DOB Phone

    John Smith [email protected] 2/4/1968 626 222-2222

    Steven Goldfish [email protected] 4/4/1974 323 455-4545

    Paula Brown [email protected] 5/24/1978 416 323-3232

    James Smith [email protected] 10/20/1980 416 323-8888

    SQL Commands:

    1. Apply SELECT statement arbitrarily to select data from the above database table. 2. Apply SQL DISTINCT clause with the SELECT statement to return Last name and Phone

    numbers from the above database table. 3. Apply SQL WHERE clause to select customers conditionally (for example customers

    having last name Smith. 4. Repeat item 3 to select customers who are younger than 40 years old. 5. Add the following individual to the above table using an SQL statement:

    Peter Hunt, [email protected], 1/1/1974, 626-888-7777. 6. Modify the Steven Goldfishs date of birth to 5/10/1974. 7. Remove James Smith from the above database table. 8. Reorder the above database table based on the customers age from youngest to

    oldest. 9. Apply SQL AND clause to select James Smith. 10. Apply SQL OR clause to select all customers having First Name James or Paula.