28th Jun 2022 8 minutes read What Is SQL? Kateryna Koidan sql learn sql Table of Contents Introduction to SQL Brief History of SQL SQL Applications SQL Examples Time to Learn SQL! SQL may be something you hear about from your colleagues. Or you may see it in the job description for your dream role or notice it in a list of the most popular programming languages. So, what is SQL? Should you learn it? Let's find out. Do you think about a career in data analysis and data science? Do you need to interact with relational databases at work? Do you want to improve your performance as a marketer, HR specialist, or researcher by making more informed decisions? If the answer to any of these questions is yes, the chances are high that you benefit greatly by knowing SQL. Start learning today with the SQL Basics course. It includes 129 interactive exercises covering all the basics for retrieving information from a database. However, if you are not yet convinced you need SQL, let's see what it is and where it is used. Introduction to SQL SQL, or Structured Query Language, is a programming language used to talk to databases. With SQL, you can store, manipulate, and retrieve data from relational databases. Now, you may be wondering: what are these relational databases? Are they common? In relational databases, the data items are organized as a set of tables with columns and rows. These data items have pre-defined relationships among them across different tables of a database. It is a very common way to store information, whether it is for a small bookshop or Amazon. As an example, you have a books table. In this table, the books are stored as row items, and the columns represent the attributes of each book such as its ID number, title, author, price, etc. You may also have a sales table that includes order ID numbers, dates, and amounts of sales. But it may also include the ID numbers of the books ordered, the ID number of the salesperson, and the ID number of the corresponding bookstore. These ID numbers are references to other tables in the database, such as books, salespeople, and stores. This means each piece of information is stored in the database only once rather than duplicated in every table that may need it. For this reason, relational databases are very efficient, and as a result, very popular across a variety of industries. However, for data to be valuable, storing it efficiently is not enough. You must be able to retrieve it efficiently. This is where SQL comes into play. SQL is a standard language that lets you combine information from multiple tables based on predefined relationships, analyze this information, and report the results. But SQL's capabilities go far beyond mere retrieval of information; it also helps you create databases and keep them up to date. Given the popularity of relational databases and the importance of SQL for communicating with these databases, every data professional needs to know SQL. Brief History of SQL Despite the popularity of the language, there is still no agreement on how to pronounce its name: S.Q.L. ("ess-cue-ell") or "sequel." There are many debates on this issue all over the Internet, and while "sequel" usually gets the most votes, Donald D. Chamberlin, co-developer of SQL, and many other SQL gurus prefer "ess-cue-ell." There is a good explanation for the "sequel" pronunciation that hides in the history of SQL. The idea of the relational database was introduced back in 1970 by Edgar Frank (Ted) Codd, an English computer scientist at IBM. He also proposed two different languages for his relational data model. Both of these languages were everything except beginner-friendly – they used mathematical notations with quantifiers and mathematical operators. The idea of the relational data model captured the attention of Donald D. Chamberlin and Raymond F. Boyce, Codd's colleagues from California. However, they realized the languages proposed for interacting with relational databases were too difficult for mass adoption. With the goal of designing an easy-to-learn query language, they introduced the Structured English Query Language in 1974. The language was based on English structures and used the acronym SEQUEL. Unfortunately, they had to change the name to avoid trademark violations, and the new name became Structured Query Language, abbreviated as SQL. Still, many prefer to pronounce it "sequel" after almost 40 years. SQL became a standard of the American National Standards Institute (ANSI) in 1986 and the International Organization for Standardization (ISO) in 1987. While no database fully implements the standard, most are very close. There are many versions of the SQL language used with different relational database management systems (RDBMS); the most popular ones are Oracle, MySQL, Microsoft SQL Server, PostgreSQL, and SQLite. SQL Applications SQL started as a language for talking to relational databases. Today, many different technologies use SQL to access data: Distributed data processing technologies, such as Apache Spark, Apache Flink, and Apache Beam, all offer SQL as a programming interface. Full-text search engines, such as Apache Solr and Elasticsearch, support SQL as a query language. You can also use SQL in common spreadsheet applications, including Microsoft Excel, Numbers, and Google Sheets. For some applications, this functionality is built in; you may need external add-ons with others. Many smartphone apps use SQLite, a lightweight embedded relational database, to store data on your phone, such as your settings and account data. It is common for emerging data technologies to add support for SQL when they reach a certain level of maturity. This article discusses more examples of SQL applications. With SQL, you can: Retrieve records from a database. You can even combine information from different tables and add multiple complex filtering conditions. Perform computations on records from a database. For example, you can group records and calculate sum/average/min/max for the attributes of interest. Insert, delete, and modify data in a database. Prepare reports based on the information stored in a database. As you see, SQL is everywhere. It is also a very powerful tool for interacting with databases and analyzing data. Is it hard to master? No! It's very beginner-friendly. I'll show you a few examples below. SQL Examples The SQL syntax is based on the English language. So, you can read SQL commands just like ordinary English sentences. Standard SQL commands are: SELECT to retrieve data from a database. INSERT to add new records into a database. UPDATE to modify records in a database. DELETE to remove data from a database. Beginners usually start with retrieving data from a database. So, let's see a few examples of SELECT commands. Imagine we run a small bookshop. We have the following table storing information about the books we have for sale. books idtitleauthoryearpricein_stock 11In Search of Lost TimeMarcel Proust200414.993 6] 12UlyssesJames Joyce202235.4910 13Don QuixoteMiguel de Cervantes200322.992 14One Hundred Years of SolitudeGabriel Garcia Marquez200611.002 15The Great GatsbyF. Scott Fitzgerald20216.495 16Moby DickHerman Melville202110.495 17War and PeaceLeo Tolstoy200815.992 18HamletWilliam Shakespeare20036.291 19The OdysseyHomer199710.991 20Madame BovaryGustave Flaubert200212.991 Now, let's say we want to get information about all books published before 2010. We want to see the book titles, authors, and publication years. Here's the SQL query to get this data: SELECT title, author, year FROM books WHERE year < 2010; You request title, author, and year from the books table for the records where the publication year is before 2010. Here's the output of this query: titleauthoryear In Search of Lost TimeMarcel Proust2004 Don QuixoteMiguel de Cervantes2003 One Hundred Years of SolitudeGabriel Garcia Marquez2006 War and PeaceLeo Tolstoy2008 HamletWilliam Shakespeare2003 The OdysseyHomer1997 Madame BovaryGustave Flaubert2002 You probably understood this query even without any prior exposure to SQL. This simple syntax is what makes SQL so attractive to new data professionals. Can you write the next query yourself? Let's say we want to know the title, author, price, and the number of books in_stock for all the books authored by Marcel Proust. Here's the query to get this information: SELECT title, author, price, in_stock FROM books WHERE author = 'Marcel Proust'; titleauthorpricein_stock In Search of Lost TimeMarcel Proust14.993 As you see, it is quite straightforward. Still, if you are new to SQL and other programming languages, you may have missed things like the quotation marks around the name "Marcel Proust" in the filtering condition. You'll learn quickly that strings are placed in quotation marks in SQL. Learn this and other syntax nuances from our 2-page SQL Basics Cheat Sheet. It demonstrates with examples how to write different clauses and filtering conditions in SQL. Time to Learn SQL! While these examples are basic, they show how easy SQL is to understand and learn even if you have no IT experience. That said, when it comes to programming languages, reading articles and watching video tutorials are not enough. The fastest way to learn a new programming language is with practice. Interactive online courses provide the best opportunity for newcomers to learn and practice at the same time. As I've mentioned, I recommend the SQL Basics course for those who are just starting their SQL journey. After completing this course, you'll know how to combine information from multiple tables, how to set complex filtering conditions, how to create simple reports by using aggregate functions, and much more. Get more information about this course, and read this comprehensive review from one of the SQL Basics students. When you are ready to go beyond the basics, check out the SQL from A to Z learning track. With seven interactive courses, this track provides an excellent opportunity to become an SQL master in no time. Thanks for reading, and happy learning! Tags: sql learn sql