SQL course [Lesson 2] - SELECT Queries

in #programmin5 years ago (edited)

image.png

SELECT Queries

In the last lecture, we already covered what the basic syntax of SQL looks like, and wrote a SELECT query already but now it is time to practice.

Recap: To retrieve data from an SQL database we need to write SELECT statements

Let's suppose we have the following table with movies:
aaa.jpg.png

Exercises

  • Find the title of each film

SELECT title FROM movies;

  • Find the director of each film

SELECT director FROM movies;

  • Find the title and director of each film

SELECT title, director FROM movies;

  • Find the title and year of each film

SELECT title, year FROM movies;

  • Find all the information about each film

SELECT * FROM movies;

It's not that hard to filter data by columns, right?
Maybe you don't remember, the asterisk ( * ) means "all". So through the last statement, we'll retrieve exactly the same table as shown in the upper picture.
To make visualization easier, here is the returned table of the "SELECT title, director FROM movies; " query.

asda.png

See? Only the relevant columns remained.

This is the material I planned for the second lesson, we are advancing in baby steps but maybe this way the material is easier to understand.

About the course

In this course I will and comment sqlbolt's tutorial and do their exercises together with you, sharing the results.

If you would like to fasten up the material or just simply practice by yourself check out their site.

Another suggestion of mine would be to have a look at Sololearn's SQL lessons. This site is also free and you can get a quite solid basic knowledge by completing their material.


Thank you for reading my article!

Follow Upvote Resteem @goodguymate



Steem Gaming Community

ya6cczq3qa.png
OP Gaming

<I suggest Partiko if you are browsing from Android/iOS and would like to earn extra $>


Header picture source | Content source

Sort:  

I have some piece of advice for you bro. Hope you don't mind. Tags are very important in a post. That is one way people connect with your post. I would recommend you use "development" as one of the tags for these posts. I also see some spelling mistakes in the tag "codeing" instead of coding. Tags help more people reach your post. Good work with the series. All the best.

Oh, wow you are so right. First of all the main topic now is programmin instead of programming (I tried to update it but didn't work out. Can you not update the primary topic of your posts?) I sincerely thought coding was written as codeing. Damn I am bad :D Adding development is a very good advice as well.
Thank you!!

Posted using Partiko Android

Yes once if you have given a primary tag, you cannot change that tag. That also gives an advantage for us. You can add one extra tag to each post by removing the primary tag on edit and adding the new tag. It's a trick. :P

And by the way, I'm not sure if I already told you this or not, join the Archdruid community for sharing your gaming articles. You can get nice rewards if your post is well written. Today I received a vote from Curie. Try to grab the moderators attention by writing good gaming articles.

Oh okay, sure thing :)
I will get home on sunday evening and I'll check the archdruids out ;)
Thanks again

Posted using Partiko Android

Coin Marketplace

STEEM 0.26
TRX 0.13
JST 0.032
BTC 61663.08
ETH 2893.40
USDT 1.00
SBD 3.48