Open Side Menu Go to the Top
Register
Learning SQL Learning SQL

04-09-2013 , 01:31 AM
I am currently a data analyst at a large company where I do analysis on portfolios we are interested in purchasing. The position is a data analyst but it's mostly grinding through a process which gets very repetitive and uninteresting. The majority of that work is done in Access with a little bit in Excel. I've started to get a little bored of this and have been trying, and succeeding, getting some small projects helping out other departments doing more business intelligence analytical work. The majority of that is done with SAS which I learned some in school and have been improving quickly with. As I do more with SAS, and potentially pursue other jobs in this area I'm wishing I had better SQL skills.

I've spent time on google trying to figure out the best way to learn SQL but there is so much out there I don't know where to start. Ideally I'd like something similar to CodeAcademy but they don't have SQL. I started through learnsqlthehardway, but it is incomplete. The majority of the SQL I use would be done in SAS, with maybe a little in Access. What say you 2p2, where should I turn?

Thanks!
Learning SQL Quote
04-09-2013 , 11:36 AM
I took the course and thought it was very good. It`s an introductory course that covers a lot of topics but it spends a large amount of time on SQL. I would highly recommend it.

Edit to add: The course is over but you can still take it as a self study course without getting a certificate of completion.
Learning SQL Quote
04-09-2013 , 11:25 PM
Looks awesome, thanks dave.

Stumpy,
Do you think it is worth spending time on the earlier sections before SQL?
Learning SQL Quote
04-10-2013 , 12:18 PM
If you're only interested in SQL then you can skip a bunch of sections like XML and JSON. The relational algebra and functional dependency sections cover some theory that is interesting but not required. I was mainly interested in learning SQL for simple applications but I still got something out of most sections.
Learning SQL Quote
04-10-2013 , 12:45 PM
The most useful titles I've found for this task are "Data Analysis Using SQL and Excel" by Gordon Lindoff and "Beginning Database Design" by Rod Stephens.

The courses I've done I wouldn't recommend as they were either too academic focused and boring (the coursera one) or they delve into SQL aspects that are important for running websites off of a database--which for data mining is mostly off track.

Also you might want to look into learning R as it's an open source language that gets contributions from a lot of great data miners, statisticians, medical researchers, etc.
Learning SQL Quote
04-10-2013 , 09:32 PM
Thanks for the tip. Yeah, a lot of what I've seen with the online courses is stuff related to websites. I'm not too interested, nor will I be spending time, in the designing of database systems. It will be more just working with various queries and getting good at that. I'll check out the book, looks interesting.
Learning SQL Quote
04-11-2013 , 12:42 AM
I don't feel like there is much to learn if you're just doing SELECT. You could probably pick everything up from some online tutorials.

Here's the cliff notes:

SELECT
FROM
WHERE
GROUP BY
HAVING
ORDER BY
LIMIT

if you know each of these you're ~90% of the way there IMO (exact syntax may differ a bit between DB vendors but you should be able to find a cheat sheet for that).

Database design has a bit more to it.
Learning SQL Quote
04-11-2013 , 03:43 AM
Good point. He may not even be allowed to enter DROP DELETE INSERT CREATE without some admin rights if working on SAS at work.

As for how much you really need. It depends on you, really. The early stuffs was pretty valuable in getting the mind set, though to be honest, I haven't used a lot of the stuff that class teaches, like XML or views. You can probably get away with just doing the SQL stuff. The db design stuff is pretty valuable but that class really doesn't teach enough on that subject.
Learning SQL Quote
04-12-2013 , 04:48 PM
Quote:
Originally Posted by ballin4life
I don't feel like there is much to learn if you're just doing SELECT. You could probably pick everything up from some online tutorials.

Here's the cliff notes:

SELECT
FROM
WHERE
GROUP BY
HAVING
ORDER BY
LIMIT

if you know each of these you're ~90% of the way there IMO (exact syntax may differ a bit between DB vendors but you should be able to find a cheat sheet for that).

Database design has a bit more to it.
It's probably also worthwhile to have an understanding of relationships between sets of data. Ie- Unions, Intersections, Differences, etc

And then some basics like Primary Keys, Foreign Keys and other constraints. Basically a general understanding of how relational databases work.

I used this site to help me with my first database assignment: http://www.w3schools.com/sql/default.asp

Shows you proper syntax that profs expect you to already know.
Learning SQL Quote
04-12-2013 , 05:06 PM
Simple joins are probably worth knowing too.

Quote:
Originally Posted by Go_Blue
I used this site to help me with my first database assignment: http://www.w3schools.com/sql/default.asp
I haven't really used w3schools so I don't have a good opinion of them. But I do know that there are entire sites devoted to spreading the word that w3schools sucks and that people shouldn't use them as a resource. Just something to keep in mind.

http://w3fools.com/
Learning SQL Quote
04-12-2013 , 05:31 PM
I guess the easiest test of the quality of advice is if they have NULL correctly explained. It sort of is, but it really isn't. They explain in the creation part that you can use DEFAULT NULL: http://www.w3schools.com/sql/sql_default.asp

Assuming that a table automagically uses NULL is a quick way to get yourself burned.

They also have in all of their table creations either varchar(255) or id. They don't bother to explain why you'd use varchar(255) or why you'd need 255, which is a result of not explaining that you can run varchar only and there is no mention of char.

It's the same complaint of all w3schools. Yeah, it's not technically inaccurate, but it is incomplete and can cause you bad habits and cause you to think about the issues in the wrong light.
Learning SQL Quote
04-12-2013 , 07:12 PM
I'm not sure about the overall accuracy of the site, but it has been helpful for me in working on my website. For example, i knew nothing about php, html, css, or javascript; but, you can just look up a bunch of syntactical things and use trial/error to learn.
Learning SQL Quote
04-12-2013 , 11:33 PM
Quote:
Originally Posted by daveT
I guess the easiest test of the quality of advice is if they have NULL correctly explained. It sort of is, but it really isn't. They explain in the creation part that you can use DEFAULT NULL: http://www.w3schools.com/sql/sql_default.asp

Assuming that a table automagically uses NULL is a quick way to get yourself burned.
NULLs are also tricky in how they play with booleans and comparisons

Code:
select * from emp where dept != 1
will not give you the emps that have NULL as their dept.
Learning SQL Quote
04-12-2013 , 11:41 PM
I looked a bit at that s3schools site. I would say that the SQL articles I've looked over are really bad. I could write an entire book on why this is bad:

Code:
CREATE TABLE Persons
(
P_Id int NOT NULL,
LastName varchar(255) NOT NULL,
FirstName varchar(255),
Address varchar(255),
City varchar(255),
PRIMARY KEY (P_Id)
)
Then, head over to NULL, and read this:

Quote:
If a column in a table is optional, we can insert a new record or update an existing record without adding a value to this column. This means that the field will be saved with a NULL value.
Sort of ambiguous. How do make the column "optional?" Don't ask that site and don't bother searching for Google for that one.

Here's one that I am certain will not work in any RBDMS:

[snip] duh [/snip]

I could find more, but why?

Maybe maybe this is okay for someone building an ultra basic site that takes in some info and spits said info out, but these are very bad explanations and the site seems to get everything wrong.

The OP wants to learn how to build SQL and analyze data. This is considerably more complex and hard to intuit than a website. He will have to master the art of running sub-select queries, splitting tables apart and mashing them back together, and get decent at figuring out a faster version of the queries he is running. This is the very least he'll have to learn about and that w3schools site doesn't seem to touch on these subjects at all. In contrast, the SQL course I linked to above hammers this stuff into your brain, and I guess that if you are only out to build websites, you'd say that it isn't really valuable or practical, but believe me, when you are trying to query million-row tables of sales, customer, and product data and spit the data out into something you can actually use, all the things that class teaches comes in real handy.

Last edited by daveT; 04-12-2013 at 11:48 PM.
Learning SQL Quote
04-25-2013 , 06:17 PM
I'd also add OP might want to read up on indexes. Indexes are useful not only in speeding joins, but for fields where you are filtering or sorting. You also need to understand the downside of indexed (they slow writing/updating/deleting, but speed up reading to put it in broad terms). If you really get into it and have a decent back end and a huge set of data, it's also worth understanding "covered indexes".
Learning SQL Quote
04-25-2013 , 06:18 PM
and maybe stored procedures, depending on how complex your data needs are.
Learning SQL Quote

      
m