To what end? If you just need to use a database in your project then I can have you going in a paragraph or two:
Transactions are your friend. A transaction is a chunk of statements that are all executed synchronously. If one statement fails (for instance the database becomes locked or inaccessible) then the whole transaction is generally rolled back to ensure consistency of the database. It's not only for safety but also performance. Without transactions for each operation you must open the database, access/write what you need, close the database. Using transactions increases performance by some orders of magnitude.
Databases should be indexed. Indexes allow data to be searched for in ideally logarithmic time. Create indices on the columns you plan to search by routinely. Columns with high cardinality (or repeated values) make poor indexes for grabbing a distinct row. You generally do not want to go index crazy and index everything as each index requires space and can begin negatively impacting performance.
SQL has caching, but as its general purpose its performance is less than amazing. And if you're storing anything complex in your database then there will be a significant penalty on marshaling/deserializing (or putting your objects in/out of the format you put them in when writing/reading from the database) your data anyhow. In other words avoid using the database so much as reasonably possible. It can very quickly become a bottleneck.
SQL is, at least in my opinion, an incredibly ugly and awkward language. It's one of those languages that kind of sort of wanted to try to be understandable/usable by non programmers, but reality made that impossible and so you end up with a syntax that just feels bloated and less than concise for the sake of natural language readability that's not really readable. It's gone through nearly 5 decades of revisions, and it shows in the interface. Once you get the basics down - toss a wrapper around the functionality in the language of your choice, and never touch SQL again.
Codecademy has a SQL course that is a decent introduction. Once you have the basics down, download some database software like postgres and just play around with it.
"Learn SQL the hard way" is what you want. It will walk you through beginner level SQL in the form of a series of exercises. If you use your imagination a little you can use those exercises as a template to get real work done.
7 comments
5 u/rwbj 04 Dec 2015 10:43
To what end? If you just need to use a database in your project then I can have you going in a paragraph or two:
Transactions are your friend. A transaction is a chunk of statements that are all executed synchronously. If one statement fails (for instance the database becomes locked or inaccessible) then the whole transaction is generally rolled back to ensure consistency of the database. It's not only for safety but also performance. Without transactions for each operation you must open the database, access/write what you need, close the database. Using transactions increases performance by some orders of magnitude.
Databases should be indexed. Indexes allow data to be searched for in ideally logarithmic time. Create indices on the columns you plan to search by routinely. Columns with high cardinality (or repeated values) make poor indexes for grabbing a distinct row. You generally do not want to go index crazy and index everything as each index requires space and can begin negatively impacting performance.
SQL has caching, but as its general purpose its performance is less than amazing. And if you're storing anything complex in your database then there will be a significant penalty on marshaling/deserializing (or putting your objects in/out of the format you put them in when writing/reading from the database) your data anyhow. In other words avoid using the database so much as reasonably possible. It can very quickly become a bottleneck.
SQL is, at least in my opinion, an incredibly ugly and awkward language. It's one of those languages that kind of sort of wanted to try to be understandable/usable by non programmers, but reality made that impossible and so you end up with a syntax that just feels bloated and less than concise for the sake of natural language readability that's not really readable. It's gone through nearly 5 decades of revisions, and it shows in the interface. Once you get the basics down - toss a wrapper around the functionality in the language of your choice, and never touch SQL again.
2 u/ThisIsMyRealName 04 Dec 2015 10:12
Codecademy has a SQL course that is a decent introduction. Once you have the basics down, download some database software like postgres and just play around with it.
2 u/tame 04 Dec 2015 11:25
Last I looked at it, w3schools had a good SQL primer.
1 u/Silver_Tube 04 Dec 2015 16:40
"Learn SQL the hard way" is what you want. It will walk you through beginner level SQL in the form of a series of exercises. If you use your imagination a little you can use those exercises as a template to get real work done.
0 u/paulcarroty 04 Dec 2015 19:56
How to leart it = work with it
Universal for all.
0 u/StupidDrunkenIdiot 05 Dec 2015 13:26
Kahn Academy has an interactive SQL course that's fairly easy to follow.
0 u/flat_hedgehog 24 Dec 2015 01:37
This guide has saved me so many times: Oracle SQL guide It's not magic but it'll give you instructions on how to use different operators.
Really, you'll want to start by creating a few simple tables in a database.