Head First SQL: Your Brain on SQL -- A Learner's Guide
Format: PDF / Kindle (mobi) / ePub
Is your data dragging you down? Are your tables all tangled up? Well we've got the tools to teach you just how to wrangle your databases into submission. Using the latest research in neurobiology, cognitive science, and learning theory to craft a multi-sensory SQL learning experience, Head First SQL has a visually rich format designed for the way your brain works, not a text-heavy approach that puts you to sleep.
Maybe you've written some simple SQL queries to interact with databases. But now you want more, you want to really dig into those databases and work with your data. Head First SQL will show you the fundamentals of SQL and how to really take advantage of it. We'll take you on a journey through the language, from basic INSERT statements and SELECT queries to hardcore database manipulation with indices, joins, and transactions. We all know "Data is Power" - but we'll show you how to have "Power over your Data". Expect to have fun, expect to learn, and expect to be querying, normalizing, and joining your data like a pro by the time you're finished reading!
master of your own database. interests interests int_id interest xvi Finding Nigel a date 282 All is lost… But wait 293 Think outside of the single table 294 The multi-table clown tracking database 295 The clowntracking database schema 296 How to go from one table to two 298 Connecting your tables 303 Constraining your foreign key 305 Why bother with foreign keys? 306 CREATE a table with a FOREIGN KEY 307 Relationships between tables 309 Patterns of data:
the same time 353 What’s up with that AS? 354 Column aliases 355 Table aliases, who needs ’em? 356 Everything you wanted to know about inner joins 357 Cartesian join 358 Releasing your inner join 363 The inner join in action: the equijoin 364 The inner join in action: the non-equijoin 367 The last inner join: the natural join 368 Joined-up queries? 375 Table and Column Aliases Exposed: What are you hiding from? 376 Your SQL Toolbox 377 xvii table of contents 9
subqueries Queries within queries Yes, Jack, I’d like a two-part question, please. Joins are great, but sometimes you need to ask your database more than one question. Or take the result of one query and use it as the input to another query. That’s where subqueries come in. They’ll help you avoid duplicate data, make your queries more dynamic, and even get you in to all those high-end concert afterparties. (Well, not really, but two out of three ain’t bad!) Outer query Greg gets into the job
Choosing the best way to query 400 A noncorrelated subquery with multiple values: IN, NOT IN 403 Correlated subqueries 408 A (useful) correlated subquery with NOT EXISTS 409 EXISTS and NOT EXISTS 410 Greg’s Recruiting Service is open for business 412 On the way to the party 413 Your SQL Toolbox 414 Inner query xviii table of contents 10 outer joins, self-joins, and unions New maneuvers You only know half of the story about joins. You’ve seen cross joins that return
to it. You’ve also had to give other people access to your data, and you’re worried that they might insert or update something incorrectly, or even worse, delete the wrong data. You’re about to learn how databases and the objects in them can be made more secure, and how you can have complete control over who can do what with your data. root bashful doc User problems 494 Avoiding errors in the clown tracking database 495 Protect the root user account 497 Add a new user 498 Decide