课程: SQL: Data Reporting and Analysis
今天就学习课程吧!
今天就开通帐号,24,600 门业界名师课程任您挑!
Make your queries faster
- [Instructor] If we click on the payment table, you can see that there are 16,000 odd results. And this query took 0.0009 seconds. Now we're going to limit our query to 25 rows, and do that by limit 25 and click go. Now you can see that the query took a little bit less time, 0.007 seconds to run. But when we're dealing with millions of rows, this sort of thing can make a substantial difference. The limit keyword works in MySQL and PostgreSQL, but unfortunately the keywords differ in different versions. So for Microsoft, the keyword is top, and you use it like this. You'd say select top 25, field name, whatever that field name may be from the payment table. And obviously you don't need that bit. And for Oracle, it would be select, I'll show you. Star from the table. And then it's used as a filter where ROWNUM is less than or equal to 25. And ROWNUM isn't a field, it's Oracle's own way of counting the rows in the database.…
内容
-
-
-
-
-
-
(已锁定)
Make your queries faster1 分钟 47 秒
-
(已锁定)
Understand SQL indexes and keys7 分钟 16 秒
-
(已锁定)
EDIT: Visualize your database7 分钟 58 秒
-
(已锁定)
Merge data across tables with JOIN5 分钟 2 秒
-
(已锁定)
Understand SQL JOINS4 分钟 16 秒
-
(已锁定)
Combine rows with SQL UNION4 分钟 49 秒
-
(已锁定)
Merge data across tables with IN2 分钟 11 秒
-
(已锁定)
Select from a selection with subqueries2 分钟 56 秒
-
(已锁定)
Challenge: Join tables1 分钟 4 秒
-
(已锁定)
Solution: Join tables4 分钟 37 秒
-
(已锁定)
-
-