GithubHelp home page GithubHelp logo

select-todo-from-list's Introduction

SELECT todo FROM list

SQL CRUD Exercise in PostgreSQL

Prepare SQL statements while testing them on a local running database.

Docker Setup

Set your database name to be tasks.
Set your database username to be tasker.
Set your database password to be taskMaster.

To Do List Application

Write these SQL statements in todo_app.sql, and run them against your newly created database:

  1. Write a query to drop the table tasks if it exists.
  2. Write a query to create a table named tasks using the Initial columns detailed below
  3. Define column id as the table's primary key
  4. Write queries to accomplish the following
  5. remove the column named completed
  6. add a column to tasks named completed_at:timestamp, that may be NULL, and has a default value of NULL.
  7. change the updated_at column to not allow NULL values, and have a default value of now()
  8. create a new task, by only setting values (not defining which columns) id = default value
    title = 'Study SQL'
    description = 'Complete this exercise'
    created_at = now()
    updated_at = now()
    completed_at = NULL
  9. create a new task
    title = 'Study PostgreSQL'
    description = 'Read all the documentation'
  10. select all the titles of tasks that are not yet completed
  11. update the task with a title of 'Study SQL' to be completed as of now
  12. select all titles and descriptions of tasks that are not yet completed
  13. select all fields of every task sorted by creation date in descending order
  14. create a new task
    title = 'mistake 1'
    description = 'a test entry'
  15. create a new task
    title = 'mistake 2'
    description = 'another test entry'
  16. create a new task
    title = 'third mistake'
    description = 'another test entry'
  17. select title fields of all tasks with a title that includes the word 'mistake'
  18. delete the task that has a title of mistake 1
  19. select title and description fields of all tasks with a title that includes the word 'mistake'
  20. delete all tasks that includes the word 'mistake' in the title
  21. select all fields of all tasks sorted by title in ascending order

Initial Columns for tasks

Column Name Datatype NULL Default
id integer false auto incrementing
title character varying (255) false
description text true
created_at timestamp (no tz) false now()
updated_at timestamp (no tz) true
completed boolean false false

Final Columns for tasks

Column Name Datatype NULL Default
id integer false auto incrementing
title character varying (255) false
description text true
created_at timestamp (no tz) false now()
updated_at timestamp (no tz) false now()
completed_at timestamp (no tz) true NULL

select-todo-from-list's People

Contributors

lorecrafting avatar taesup avatar theremix avatar

Watchers

 avatar  avatar  avatar  avatar

select-todo-from-list's Issues

Drop db before dropping user

Put drop DB step before dropping user step because running subsequent student scripts will say that user cant be dropped because objects depend on it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.