MySQL Database Activity 2
This activity will test your knowledge on basic sql statements. To review our MySQL Lessons and Tutorials, kindly visit this link MySQL Tutorials Compilation. The answers can be found on our facebook page or you can download the answers here.
1. Write the complete SQL statement for creating a new database called contacts.
2. How would you list all the databases available on the system?
3. Create a table called contacts_data with the following field:id, firstname, lastname, age, email, address, contact_number. Apply the appropriate data type.
4. Issue the command that will list the information of the table.
5. Write the statement for inserting the following data in contacts_data table.
6. Give two forms of the SELECT statement that will list all the data in contacts_data table
7. Write the statement for inserting the following data in contacts_data table in a single query.
Pascual, Milby, 36, abc@yahoo.com, Vito, 123456
Sam, Ondoy, 45, sam@yahoo.com, Escalante, 654321
Angel, Algara, 24, angel@yahoo.com, Escalante, 09293831491
8. Write the SQL statement to update the age into 23 and the email into sample@facebook.com where their address is Vito.
9. Write the SQL statement to delete the record whose age is greater than 35.
10. Write the SELECT statement to extract the firstname and email whose address is Escalante
11.Display the records (last names followed by first names) whose address is either “Vito” or “North Pole” and sort their name in descending order
12. Order the records on the basis of their age (ascending).
13. Write the SQL statement that will select the unique value in the field of address.
14. List all ids and lastname between 33 and 40 years of age.
15. Issue the command to extract the next two records starting with the first row.