Skip to content

Instantly share code, notes, and snippets.

@lundeen-bryan
Last active September 17, 2023 21:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lundeen-bryan/39be16301f17cff2b143547a4d563d76 to your computer and use it in GitHub Desktop.
Save lundeen-bryan/39be16301f17cff2b143547a4d563d76 to your computer and use it in GitHub Desktop.
sql_notebook_text
/*markdown
# MySQL vs. MSSQL
Typically in MSSQL we escape keywords by placing them in square brackets, but in MySQL it is not necessary. Sometimes it may cause errors.
*/
SELECT *
FROM `sakila`.`customer`
LIMIT 10
;
/*markdown
I used the following in ChatGPT to create a new table:
```markdown
What MySQL statement will create a table called rental_history with the following columns:
- rental_id
- customer_id
- file_id
- rental_date
```
Below I will put the statement given by ChatGPT and the result.
*/
USE sakila;
DROP TABLE rental_history;
/*markdown
**USE the "USE" Command**: I just notied that in mySQL it's better to use the USE command to indicate which database we're talking about when using a SQL Notebook. May not be so necessary if using Jupyter notebook, but otherwise, this is better.
*/
CREATE TABLE rental_history (
rental_id INT AUTO_INCREMENT PRIMARY KEY,
customer_id INT,
file_id INT,
rental_date DATE
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment