From the course: From Excel to SQL

What is SQL?

- So before we start to use SQL, let's take a moment and spend some time looking at what SQL actually is. Firstly, SQL is a language, and it's a language you can use to talk to databases. It gives you the ability to ask a database questions. Now, SQL has a relatively simple syntax, but don't let that fool you. You have the ability to ask really complex and powerful questions of the database. If you want to create, read, update, or delete data within a database, then you want to know how to use SQL. And this combination of create, read, update and delete is commonly known as the CRUD operations. In this course, we'll focus mainly on the read operation. This is all about writing SQL to query the database for the data that you're interested in. Some history about SQL. It's an acronym that stands for structured query language, and it's been around for a long time. In fact, it was created in the 1970s before becoming a standard in the 1980s. By the way, how you pronounce SQL is often debated, which is why you may hear other people calling it SQL. There's a history behind the difference in pronunciation and I encourage you to research it if you're interested. Ultimately though, the pronunciation is a personal preference. For this course, I'm going to stick with SQL. This is the common pronunciation when referring to the language itself. Let's take a look at the component parts of an SQL statement. We'll learn more about what this statement is doing in future lessons. SELECT * FROM Employees WHERE tshirt_size = 'S'; the SELECT, FROM and WHERE words are known as keywords and will direct the database to take some kind of action for us. SELECT tells the database you want to find records and have them return back to you. FROM Employees tells the database which table to look in for the data you want. The WHERE tshirt_size = 'S' tells the database that you only want rows returned that have the tshirt_size field equal to S. The FROM Employees and the WHERE tshirt_size = 'S' are called clauses. An SQL statement is terminated with a semicolon. This tells the database where the end of the statement is. Now some databases allow you to end the statement without one. However, it's usually a best practice to end all statements with a semicolon. You'll notice that SELECT, FROM and WHERE are typed in uppercase since that's the SQL standard. However, this is not required and the statement will still work if written all in lowercase. I'm going to use uppercase keywords throughout the course. It'll help differentiate keywords from the rest of the statement. Whew, that was a lot of theory. The good news is you don't need to worry about the history or origins of this language to be able to use it. With SQL, you only need to learn how to write questions that the database can understand.

Contents