1. Create a database named "stayfitdb" (username: username; password: password)

  • You can you the GUI to create the database
  • Create a schema name "stayfitapp"
  • Thus to access the table you will use the following format "stayfitapp.tablename"

2. Write SQL statements that create two tables

  • users
    • username (varchar) (primary key)
    • firstname (varchar) (not null)
    • lastname (varchar) (not null)
    • gender (varchar) (not null)
    • (The String "male or female should be the values saved in this field)
  • userdata
    • currentdate (date) (not null)
    • weight (float) (not null)
    • height (float) (not null)
    • waist (float) (not null)
    • hip (float) (not null)
    • age (integer) (not null)
    • activitylevel (integer) (not null)
    • username (varchar) (foreign key)

3. Write SQL statements that insert 10 records in the users table

4. Write SQL statements that insert 10 records in the userdata table

5. Write 2 queries that update the lastname of 2 record in the users table

Write 2 queries that update the weight of 2 record in the userdata table

6. Write a query that deletes 1 record from the userdata table

7. Write a query that displays all rows in the users table and sort them in descending order based on based on lastname

8. Write a query that displays all records in the userdata table where the currentdate is between January 1 2019 and December 31st 2019 inclusive.

9. Write a query that displays all weights records in the userdata table where the activity level is between 3 and 6 inclusive and age >18

10. Write a query that prints firstname, lastname, currentdate, and weight for one of the users (Hint you will need to join to 2 tables for this)

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.