Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (SoranĂ®)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
‫All right, Querrey time.
‫So in the previous video, we ended on talking about queries, a query is nothing more than an instruction
‫write in English.
‫A query is defined as a question.
‫And Enescu, well, queries are the way that we are going to put together our questions to which we
‫want an answer from the database.
‫A query is also known as an equal statement.
‫Those are just synonyms.
‫Query is equal to ask you all.
‫Statement, as you will statement is equal to a query, just different ways of saying the same thing.
‫So if we look here, there is a very basic query select star from users.
‫And if we were to break this down, what it's basically saying is select us all of the information.
‫So the star here is what we call a wild card.
‫We don't know what we want to get back, but just get us everything back.
‫So select us everything from so we're going to say where we want it from.
‫And we know somewhere in our database we are storing users.
‫Right.
‫So select us everything from users.
‫All right.
‫That's pretty straightforward.
‫So let's execute that.
‫All right, so here we see select star from user over here, let's just copy paste all of this information,
‫just put it in your DB fiddle.
‫Let's not worry about that just yet.
‫And if we execute our command select star from user, what we're going to get is a bunch of information
‫because a bunch of user information was input it.
‫We can see they have an ID, they have a name, a last name, date of birth, sex on a roll.
‫Awesome, so we can see here that select star from user is actually selecting us all of the information
‫that we have around that user.
‫And if we filtered and we just said name, what we would see happen is we would only get the name back.
‫Amazing, so let's hop back into the slides and check out what a breakdown of equerry looks like.
‫So here we've expanded the query a bit because we want to break down something a little more complicated.
‫So let's say we did select name, so select the user's name from.
‫Our datasource users in the database where.
‫Rule is equal to manager, so this is new, right, where role is equal to manager.
‫This is what we call a condition.
‫So where is our key word?
‫And we're seeing where the role of the user is equal to manager return the name.
‫I hope that makes sense.
‫We're filtering data at this point.
‫We're seeing where the roll is equal to manager of the user.
‫Give us back their name.
‫And so if we were to break down this query and we looked at it line by line.
‫Select name is a clause from users, is called a clause, and where role is equal to manager is called
‫the clause.
‫These are just parts of the school statement or the query.
‫So each line here is called a clause.
‫And when we select name, name is called an identifier.
‫Now, what does an identifier and identifier is just a different word for a part of the data.
‫We know that users have a name, so when we select name, we're saying that name is the identifier that
‫we want.
‫And when we look at the last line where role is equal to manager, our filtering line, this is a bit
‫more complicated, right?
‫Where is our keyword?
‫Role is our identifier.
‫But the line role equals manager is called the condition, so a condition is something that needs to
‫be met.
‫We're saying that, OK, a user has a role, that role needs to be equal to manager in order for us
‫to get some data back.
‫Pretty straightforward and manager is called our expression.
‫We are expecting that some of the roles may be equal to manager, but some may not be.
‫So that's why we call it an expression, because we are making an assumption here that some of the roles
‫are equal to manager.
‫We want to filter based on our assumption.
‫Awesome.
‫So let's fire that real quick.
‫All right, so we have our query here ready to go, so let's run it.
‫And as you can see, we are getting back, George, Janene and Jason.
‫So let's verify that that's actually what we want.
‫So let's get back all of the information.
‫All right, so we see here, George, Janene and Jason, and we see that the role is equal to manager,
‫all right, that makes sense.
‫But who else did we have here again?
‫So let's go look at that.
‫This is a way to put a line in comment, you just you don't want to execute that line, it's a quick
‫way of turning lines on and off.
‫So let's run that.
‫So here we can see, OK, George is a manager, and then we had Maizie and Bill who are employees,
‫OK?
‫That makes sense.
‫So let's turn that line back on if we run it.
‫And we said, OK, now filter us, the employees.
‫Awesome, so we see Macy and Bill come up.
‫All right, awesome.
‫So now it's all starting to come together, right?
‫We know how to build a very, very simple query.
‫And I would push you to copy paste what's in here.
‫Put it in your DB fiddle and try to write some simple queries where you filter and you select certain
‫fields, and that way you can play around with it.
‫So we've done our break them and now we know all of the different parts that go into equerry, and that's
‫super powerful, right?
‫Because now we've just said select name from users where role is equal to manager.
‫We asked a question and we got an answer back.
‫This is what we call a declarative language.
‫School is a declarative language.
‫Now, what does that actually mean?
‫Well, let's dive a bit deeper into that.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.