
Best way to get started with SQL? - comatory
Hello friends.<p>I started programming almost year ago and I still very much enjoy it that I&#x27;ve considered to turn it into a career (even though I&#x27;m approaching 30 now).
Anyways, 80% of the jobs seem to be requiring knowledge of SQL and relational databases.<p>Now my skills are still somewhat basic but I&#x27;m accustomed to the learning process. I&#x27;ve gone through Learn Python The Hard Way, created my first little program and now crunching through Swift book - so there you go.<p>My only experience with SQL was using MySQL interface when setting up Wordpress installations. I&#x27;m looking for something that is approachable with lots of good examples and possibly exercises.<p>Is there a good book, youtube channel or course (Udemy) that I should look at?
Mind you I&#x27;m pretty serious about it so I don&#x27;t really mind spending some money (less than $100 though) but if there is good free material, even better! I&#x27;ve had somewhat positive&#x2F;negative relationship toward Youtube tuts - I found one that was great for Tkinter framework but for Django I had to go through a book to understand it properly.<p>Thank you!
======
davismwfl
You have already gotten good academic and research based advice, so I'll toss
something else in.

Install MySQL on your machine to play with. If you have access to a Wordpress
install that has some data in it, take a backup of that and restore it to your
machine and learn how to write queries for it. The way to figure out what to
query is ask yourself questions, like, how many blog posts were posted in the
past year. What was the count of blog posts per month for the past year. Stuff
like that. And anything that you could see someone asking you to answer. BTW
-- I am not suggesting that Wordpress is an amazing database design, but it is
fairly typical of what people do so its a reasonable place to learn.

Then once you feel pretty comfortable there, take a couple of the public
datasets you can find online, Amazon shares a bunch of them and you can find
others. Then create a database, import the data and write queries against it,
following the same process of asking questions that seem interesting. You can
even take the max-mind CSV file they provide and create a database out of that
to learn how to query it and get answers. It is a small and simple dataset but
there are a number of things you can figure out using it.

While I personally prefer postgres, I think MySQL is probably a good place to
learn as there are a ton of tutorials and resources for it. After you master
the concepts then you can switch between platforms much easier, MS SQL, MySQL
etc. The basics are the same between them all, even though each has their own
quirks and gotcha's, knowing how to work in one you can always ask Google how
to do X in Y if you already know how to do X.

------
joeclark77
I recently asked my 4th-year students (who take a relational database course
in their 3rd year) how much they used what they learned from the database
course. Most of them had internships between the 3rd and 4th year, and they
told me that in their jobs they needed to (a) write complex queries and (b)
write stored procedures. Our database course had focused, I think, too much on
ER diagramming and things like field data types. You need to know those things
to _create_ a database, but as a new person I guess you're more likely to have
to deal with a database that already exists.

To my point: make sure you learn how to do complex SQL queries including
subqueries and correlated subqueries. Also, learn to create stored procedures
and triggers in your favorite database.

You might look into the book "Refactoring Databases" by Ambler and Sadalage.
It challenges you to think about the database as an evolving system, which is
different than the kind of textbook exercises where you just sketch or build
it once and then move on to the next problem.

------
techjuice
If your really serious about enhancing your SQL skills the following should
take you from beginner to expert with time. Udemy and other online resources
are nice but they will not take you to your maximum potential, only the books
and official documentation will as that is where the experts get there
information. The videos and tutorials are good for overviews and helping with
certain scenarios but not the best resources if you want a professional high
end learning path to the top.

If you want working with SQL to become extremely easy to you, you will need to
start creating websites, bring traffic to those sites and implement the
scaling procedures you have learned from the books below.

As if you go to a job interview and want to blow it out of the water it is to
your best advantage to know for example MySQL in and out so well you make the
interviewer smile inside and go yes we have found the one. You will probably
see a little smirk as the interviewer is trying to hold in their smile when
this happens but you will know when this occurs very easily. Upside to this is
you will be very comfortable getting started on day one and the only training
you will need is the current architecture and backup or non existent backup
plans in place so you can get to work.

I recommend the following hardcopy books in order:

MySQL: [http://www.amazon.com/MySQL-Developers-Library-Paul-
DuBois-e...](http://www.amazon.com/MySQL-Developers-Library-Paul-DuBois-
ebook/dp/B00C2SFK2Q)

www.amazon.com/High-Performance-MySQL-Optimization-Replication/dp/1449314287/

[http://www.amazon.com/MySQL-High-Availability-Building-
Cente...](http://www.amazon.com/MySQL-High-Availability-Building-
Centers/dp/1449339581/)

If your wanting to do Microsoft SQL Server, I recommend the following:
[http://www.amazon.com/Microsoft-Server-2012-Step-
Developer/d...](http://www.amazon.com/Microsoft-Server-2012-Step-
Developer/dp/0735663866/)

[http://www.amazon.com/Training-70-461-Querying-Microsoft-
Ser...](http://www.amazon.com/Training-70-461-Querying-Microsoft-
Server/dp/0735666059)

[http://www.amazon.com/Training-70-462-Administering-
Microsof...](http://www.amazon.com/Training-70-462-Administering-Microsoft-
Databases/dp/0735666075)

~~~
comatory
cool thanks. should I start with the first one? i just need to emphasize that
I'm still fairly beginner so I want to be sure that I can understand it and go
gradually from easy to hard.

~~~
techjuice
Yes the first MySQL book will take you a long way and lay most of it out for
you very nicely. The other books add on to the foundation that is given to you
in the first book.

Part One gives a really good overview of writing queries for mysql, optimizing
them, understanding all the data types etc.

Part Two gives you the practical hand on that you need in multiple programming
languages C, Perl, and PHP.

Part Three teaches you administration and security which helps complete the
circle of knowledge. As you don't want to be a developer that does not know
how to talk the Database administrator language. As the more you know and
learn the better you and others can help optimize and secure the different
development, staging and production environments applications and hardware.

------
timClicks
I would start with adding fields to a CSV from some open public data and
building reports that include featurs like GROUP BY month and ORDER BY
city_name.

That'll give you some understanding of the richness that's available to you
when you start to use SQL. Until you get why SQL is amazing, SQL will feel
like a chore.

Once you feel comfortable with custom reports, you should learn about
performing queries on queries (via subqueries, CTEs or views ... all very
similiar) and queries between tables (JOINs).

Once you have JOINs and subqueries down, you'll be able to do things that are
both blazing fast (compared to similiar operations in your application) and
extremely memory efficient.

~~~
dorfuss
Excellent advise - the biggest problem most people have when starting playing
with databases is that they don't have any data to begin with. Unless you
have, let's say, a couple of tables 1000 records each, you cannot actually
grasp the significance of what you're doing.

Search for elections results, weather/climate change, air pollution, crime
rate - there's a lot of it online.

