Skip to content

Instantly share code, notes, and snippets.

@0bie
Created December 29, 2017 23:16
Show Gist options
  • Save 0bie/3b9c5a0f91a08c37d5defa4ff34bcac8 to your computer and use it in GitHub Desktop.
Save 0bie/3b9c5a0f91a08c37d5defa4ff34bcac8 to your computer and use it in GitHub Desktop.
Learning SQL

SQL

Log into database: mysql [db_name]

View a table: SELECT * FROM table_name;

Update a record in a table:

UPDATE [table_name] SET [table_column] = NOW() WHERE id = 1;

For Action Plans

table_name = users_tasks

Order table view

SELECT * FROM users_tasks ORDER BY timestamp_due ASC;

Change the time for a task

UPDATE users_tasks SET timestamp_due = NOW() - INTERVAL 8 HOUR + 200 WHERE id = 7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment