1 00:00:00,510 --> 00:00:03,650 There are two important components to each data base. 2 00:00:03,650 --> 00:00:06,530 The information that's stored in it called data, and 3 00:00:06,530 --> 00:00:09,340 how the data is organized called the schema. 4 00:00:09,340 --> 00:00:12,360 The schema establishes how that data should be stored and 5 00:00:12,360 --> 00:00:14,780 divided into different sections. 6 00:00:14,780 --> 00:00:19,520 The schema further determines how each of the sections relates to other sections. 7 00:00:19,520 --> 00:00:22,000 These sections are called tables. 8 00:00:22,000 --> 00:00:26,200 It's easy to picture a database by thinking of the spreadsheet. 9 00:00:26,200 --> 00:00:30,300 You know what spreadsheets look like from programs such as Microsoft Excel, 10 00:00:30,300 --> 00:00:32,990 Apple Numbers, and Google Sheets. 11 00:00:32,990 --> 00:00:36,780 They look like a large grid composed of columns and rows. 12 00:00:36,780 --> 00:00:42,270 Rows from left to right horizontally, and the columns run top to bottom, vertically. 13 00:00:42,270 --> 00:00:46,770 Just remember columns are like the columns supporting a building, they're vertical. 14 00:00:46,770 --> 00:00:50,000 And the rows are like the rows of a corn field, horizontal. 15 00:00:51,000 --> 00:00:54,730 Remember, the sections of a database are called tables. 16 00:00:54,730 --> 00:00:59,060 You can think of a table as its own spreadsheet full of rows and columns. 17 00:00:59,060 --> 00:01:03,310 Typically, each table contains data for a specific type of thing. 18 00:01:03,310 --> 00:01:08,040 For example, If I ran a T-shirt store, I would want to store my inventory in 19 00:01:08,040 --> 00:01:12,930 one spreadsheet or table, and the orders in another spreadsheet or table. 20 00:01:12,930 --> 00:01:15,680 Let's have a look at what the inventory table would look like. 21 00:01:16,990 --> 00:01:19,640 Each row represents a single thing. 22 00:01:19,640 --> 00:01:23,150 In the case of inventory it's a particular shirt type. 23 00:01:23,150 --> 00:01:26,810 With it's name, size, price, and stock count. 24 00:01:27,810 --> 00:01:29,390 Now let's look at the orders table. 25 00:01:29,390 --> 00:01:33,833 [NOISE] We have the columns product name, size, price, 26 00:01:33,833 --> 00:01:38,667 quantity ordered, customer name, and customer address. 27 00:01:38,667 --> 00:01:42,010 Each row in this case is an individual order. 28 00:01:42,010 --> 00:01:46,010 Like in our example the database tables contain data 29 00:01:46,010 --> 00:01:48,850 with each table containing one type of thing. 30 00:01:48,850 --> 00:01:50,990 Orders and inventory. 31 00:01:50,990 --> 00:01:54,810 Let's look at the inventory spreadsheet as if it were a database table now. 32 00:01:54,810 --> 00:01:58,253 Depending on the SQL you write, you can filter information. 33 00:01:58,253 --> 00:02:03,297 [SOUND] For example, you could filter the table to get all of the items 34 00:02:03,297 --> 00:02:08,358 in the inventory table that have the stock count greater than 15. 35 00:02:08,358 --> 00:02:11,470 You don't even have to show all columns. 36 00:02:11,470 --> 00:02:15,170 In fact, you can arrange the columns in any order you want. 37 00:02:16,490 --> 00:02:18,600 Now this an important note. 38 00:02:18,600 --> 00:02:23,520 When you filter data in this way, no data has been deleted from the table. 39 00:02:23,520 --> 00:02:26,940 You're just selecting what information you want to bring back 40 00:02:26,940 --> 00:02:28,970 from the table with that query. 41 00:02:28,970 --> 00:02:31,680 All information is still in the database table. 42 00:02:31,680 --> 00:02:34,580 You can bring it all back with no trouble. 43 00:02:34,580 --> 00:02:36,840 Because of both SQL's flexibility and 44 00:02:36,840 --> 00:02:40,640 the fact that the queries leave your underlying data untouched, 45 00:02:40,640 --> 00:02:45,160 your data can be used in many different applications and settings repeatedly. 46 00:02:45,160 --> 00:02:47,705 From the website view a user sees. 47 00:02:47,705 --> 00:02:50,825 To a more detailed view in an administration panel. 48 00:02:50,825 --> 00:02:53,675 To a report being run by a business analyst. 49 00:02:53,675 --> 00:02:56,285 The same data can be shown in different ways. 50 00:02:56,285 --> 00:02:58,225 And that's the true power of SQL.