DEV Community

Cover image for Learning SQL for 30 days, Day 2.
Harriet Njoki
Harriet Njoki

Posted on

Learning SQL for 30 days, Day 2.

Today started out pretty late, it is currently 11:12pm, I spent a couple of hours trying to figure out how to set everything up.

First lesson for today was learning what a database is and what a table is and how each one of them works.
I learnt how to create, use and drop databases, set them to read-only mode.

11:50, I still cannot figure out how to create a table, all I'm getting is an error code 1046. I'll be damned.

12:06 AM, I finally figured it out, lol. I had missed a small detail there, haha. Selecting the default DB to be used and how to select a table. Here is an example;

CREATE TABLE employees (
employee_id INT,
first_name VARCHAR(50),
last_name VARCHAR(50),
hourly_pay DECIMAL(5, 2),
hire_date DATE
);

SELECT * FROM employees;
Image description

You can also rename your table, this is mind-blowing, I would say. I am really enjoying it.

12:22 AM. Today's learning was fun, it is something small but I really enjoyed it. I might extend my learning for today too, but I am not so sure or just watch a couple of YT videos and read some documentations too.

Top comments (0)