From the course: SQL: Data Reporting and Analysis

What is SQL?

- [Instructor] SQL stands for Structured Query Language and it's used to retrieve data from databases. You'll often hear people refer to SQL as sequel. When we talk about databases, in this course, we mean relational databases. They can be thought of like a spreadsheet, in that they have tables and columns. Relational databases are the most popular kind and they've been around since 1970. Now, there's some good news and some bad news. The bad news is that there are lots of versions of SQL. In fact, each company that makes database software, such as Oracle or Microsoft, uses a slightly different version of SQL. The good news is that they're all similar at a basic level and this course covers all the main ones, Oracle, Microsoft, PostgreSQL, and MySQL. There is an ISO standard that acts as a template for these vendors. In fact, there's nine, I think, and this blog post is a good place to start if you're interested in that. Within each type of SQL, there are some different versions, as the language has changed over the decades. For Microsoft, I've tested my queries against SQL server 2017. For Postgre I've used 9.6. for Oracle I've used 11g Release 2. And if you are using the demo MySQL database, then I'm using version 8.03. If you're using a slightly different version, it's possible that there will be differences with this course, but those should be small. We're going to be using an online demo database for this course and I'm going to show you how to find it. There's a reason I'm doing this rather than giving you a permanent link. And there it is, sakila try phpMyAdmin. That's the name of the software, web-based software that we're going to use. So a word of warning here. Anyone across the whole world can access and alter this database, including deleting the entire thing. They can also move it. I believe that the database is recreated each day so it's possible one day that you try and find a database or a table within it, and you can no longer see it. If this happens, try a few hours later or the next day. Don't consider this link to be a permanent link. It's best that you Google for yourself in case the link address changes. If the entire database is unavailable, come up here where it says Current server, top left, and change to MariaDB. And that should work just as well. You don't need to use the demo database. You can follow along with your own company database. You'll have to adapt the queries and listen out when I tell you that the keywords or syntax differs between different versions. If this is you, it will be useful for you to know which version or which type of SQL you're using or which vendor has made the database. You can't always tell by looking at the reporting system. You could be using a Microsoft reporting system that's connected to an Oracle database. We can find out typically using code, but unbelievably, there is no simple command that works across all types of SQL, so we have to do some detective work. First of all, work out where to run your queries. In phpMyAdmin, that is under the SQL tab here. Then you can try select version and click go, and you can see the version is returned here as 8.03. Now, if select version works, you'll be using MySQL or Postgre, because those commands only work in those types. And if you get a number of around 12, you're using Postgre, and a number around eight you're using MySQL. If that doesn't work, try select @@version. And if that works, you're using Microsoft. And if that still doesn't work, try select star from the dollar version. And if that works, you're using Oracle. If none of these has worked, you could be using a database from another vendor. And there's quite a handy list of relational database management systems here on Wikipedia. As you can see, there's an awful lot of them. If you can, try asking your IT department which system is yours, or follow along using the demo site.

Contents