Creating SQL databases
Welcome to SQL
- [Instructor] The world is full of data. Every app that you use is full of data. On Khan Academy, we store data about users and badges and progress. On Facebook they store data about who you are, who your friends are, and what they're posting. On Bank of America they store data about how much money you have and what accounts that's in. How do these apps store data? Well, they use a database which is a program that helps store data and provides functionality for adding, modifying, and querying that data, and doing that all fast. Databases come in many forms, but a really popular type of database is called a relational database. It stores each kind of data in a table, which is kind of like storing data in a spreadsheet. A row represents an item, and a column represents properties about that item. For example, to store data about Khan Academy users, we'd have a users table with a row for each user and columns for properties like their nickname and location. Relational databases make it particularly easy to form relationships between tables. For example, in order to store Khan Academy users and their badges, we might have a users table and a badges table, and then a user badges table to remember which users earned which badges, just by mapping user IDs to badge IDs. That's a more efficient form of storage than having to repeat everything about the user and everything about the badge in the user badges table. Most database come with a query language to interact with the database. SQL is a language designed entirely for accessing databases and is the most popular of them. With SQL, we can create tables, change data, get back the data we're interested in. Like if we wanna find out which users joined in the last week or which users have a particular badge. That's what we're going to teach here. And you'll actually get to try out SQL here in the browser using SQL Lite, a particular implementation of it. You won't be able to write the whole app here, but when you're done learning SQL, you'll have a much better understanding of how data is stored in the apps that you use and be able to use SQL if you ever build an app.