TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: I want to start learning about databases, where should I start?

58 pointsby ARRalmost 15 years ago
I hear about so many different types of databases and so many similar kinds of databases, which is the one I should start to learn about so that I get a good understanding of how databases work and how it can be used in programming?

22 comments

keyistalmost 15 years ago
If you use Firefox or a similar program that makes use of SQLite, that would be the best place to start -- you'll get experience working with a database populated with real data that is relevant to you, and one that has been designed for practical use instead of just a book example.<p>Copy ~/.mozilla/firefox/&#60;profile_name&#62;/*.sqlite into another directory and start playing with those files. It should be easy to come up with things you want to find out. Start with some basic single-table ones like 'what are my 10 most visited pages'. Then expand to use multiple tables ('what are my 10 most visited pages that I have not bookmarked').<p>Once you have an idea of how queries work, think about the database design and the decisions that led to it -- why did the developers choose to relate tables to each other that way? What kinds of queries are the indexes there to optimize for?<p>Once you've done this, rinse and repeat with a variety of programs so you can get multiple perspectives. <a href="http://www.sqlite.org/famous.html" rel="nofollow">http://www.sqlite.org/famous.html</a> or google around for others.
评论 #1427507 未加载
评论 #1427538 未加载
gxtialmost 15 years ago
As pointed out by others here already, SQL may not be the optimal fit for every scenario at large scales but it will nearly always work at smaller scales, and I can't imagine that you're already trying to write the next amazon.com. So in other words, start with SQL.<p>There are three main free software SQL databases: MySQL, PostgreSQL, and SQLite. Don't use MySQL, it'll get you into a great deal of bad habits, is missing an ass-ton of useful features (the default engine doesn't even support transactions), and likes to corrupt data. It also has questionable licensing and is owned by Oracle (a commercial database vendor) which as you can imagine doesn't have a lot of incentive to improve it.<p>SQLite is a very robust database that is great for read-mostly sites (like blogs) and for embedding into applications (Firefox for example). Its primary limitation is that there can only be one writer at a time. It is very easy to pick up and get going with since there's no persistent daemon, you just point it at a file and start writing. I'd recommend starting here.<p>PostgreSQL is the more featureful database and supports hundreds of concurrent connections, locking, access control, etc. This is the real "workhorse" database you're likely to find in production at large sites that do make use of free-software RDBMS. Eventually you will need to use something more powerful than SQLite, and this is probably it.
vital101almost 15 years ago
I recommend checking out Apache Friends site download XAMPP. That will set up a fully functional web environment (Apache, PHP, MySQL) which will let you play a bit with database. It also comes packaged with PHPMyAdmin, which is great for learning how to create tables and the like.<p>Also, you'll need to learn SQL. Check out <a href="http://www.w3schools.com/sql/default.asp" rel="nofollow">http://www.w3schools.com/sql/default.asp</a> for a good primer on the subject.
SkyMarshalalmost 15 years ago
First learn Relational fundamentals correctly from Chris Date and Fabian Pascal, then branch out into other more trendy stuff like NOSQL.<p><a href="http://en.wikipedia.org/wiki/Christopher_J._Date" rel="nofollow">http://en.wikipedia.org/wiki/Christopher_J._Date</a><p><a href="http://en.wikipedia.org/wiki/Fabian_Pascal" rel="nofollow">http://en.wikipedia.org/wiki/Fabian_Pascal</a>
评论 #1427752 未加载
评论 #1428163 未加载
sicularsalmost 15 years ago
The only thing you really need to understand about databases is that they store data for you, ie. they persist data. So once you get that then you start asking questions like "where" and "how".<p>The "where" is on hard drives. Don't let anyone tell you that a purely memory resident data store is a database, it's not. It's a cache. If you aren't writing to disk you are not a persistent database. Think memcached and redis. Although I would say the later is more of a database because you can configure it to write on every update.<p>The "how" is where all the devilish details are. How do you put data into and get data out of a database. How does the database store your data on disk. Well, there are two main schools of thought in the market place at the moment. Relational[0] and non-relational. Relational is the older more mature, more well supported, more well understood, more "standards" compliant of the two. Nowadays, non-relational is championed by the NoSQL[1] movement which eschews the relational model for a looser concept, less defined, less "compliant", less understood model. You will find many more and varied answers to "how" in the non-relational space precisely because the renaissance in non-relational is so fresh (the concept itself has been around a long time). Nevertheless, NoSQL has been attracting considerable attention over the last year or so in the open source community.<p>Every developer worth his salt will know or at least be familiar with the relational model and at least one or two of it's implementations. MySQL, PostgreSQL and SQLite are just three of the most popular open source RDBMS's (relational database management system)[2] around today. They all have varying degrees of support for the primary language used to speak to RDBMS's, SQL[3].<p>There are many open source, non-relational implementations in production today. HBase, Cassandra, Riak, Voldemort and MongoDB are all playing in the NoSQL field. Popular systems within NoSQL draw their lineage from either the Google approach (gfs[4], big table[5]) or the Amazon approach (dynamo[6]). Yet another is Neo4j, a graph database[7] which, at the moment, is lumped under the "NoSQL" moniker but is a separate beast entirely. Just like their relational cousins, the way NoSQL solutions do what they do and what they are best suited for vary.<p>As with most interesting discussions, which approach is best is left as an exercise for the reader. I'll just throw my two cents in for good measure. First I would say that you need to know SQL. Knowing SQL and not a specific system (like mysql or postgresql) will allow you to move in between relational systems and let you pick the right one for the job. After taking a look and familiarizing yourself with the SQL world, I would take a very serious look at what is going on with NoSQL. Best I can tell, there is a lot of mindshare and "cool" factor foisted upon this space right now because of the scale non-relational concepts can bring to enterprise users. Be sure, though, that rdbms is the predominant player in the database world. Every company large and small use some form of rdbms. Newer more forward looking companies that have large and very large scale needs to store and analyze vast quantities of unstructured or loosely structured data are looking more and more to non-relational NoSQL solutions.<p>I specifically avoid linking to particular implementations but rather link to broader concepts here. It is the concept that is more important than the implementation when learning about the big and confusing world of databases.<p>[0] <a href="http://en.wikipedia.org/wiki/Relational_model" rel="nofollow">http://en.wikipedia.org/wiki/Relational_model</a> [1] <a href="http://en.wikipedia.org/wiki/NoSQL" rel="nofollow">http://en.wikipedia.org/wiki/NoSQL</a> [2] <a href="http://en.wikipedia.org/wiki/Relational_database_management_system" rel="nofollow">http://en.wikipedia.org/wiki/Relational_database_management_...</a> [3] <a href="http://en.wikipedia.org/wiki/SQL" rel="nofollow">http://en.wikipedia.org/wiki/SQL</a> [4] <a href="http://en.wikipedia.org/wiki/Google_File_System" rel="nofollow">http://en.wikipedia.org/wiki/Google_File_System</a> [5] <a href="http://en.wikipedia.org/wiki/Big_table" rel="nofollow">http://en.wikipedia.org/wiki/Big_table</a> [6] <a href="http://en.wikipedia.org/wiki/Dynamo_(storage_system)" rel="nofollow">http://en.wikipedia.org/wiki/Dynamo_(storage_system)</a> [7] <a href="http://en.wikipedia.org/wiki/Graph_database" rel="nofollow">http://en.wikipedia.org/wiki/Graph_database</a>
评论 #1427895 未加载
timtadhalmost 15 years ago
If you want to learn more than just how to use a database I recommend Ullman's and Garcia-Molina's "Database Systems: The Complete Book."[1] It has overview of classic topics such as relational algebra and calculus, practical topics such as using a SQL database, and the second half is devoted to an overview of how databases are actually implemented. Unfortunately I don't know of a book that will introduce you to things like column-stores and such, my knowledge comes from reading papers on them.<p>[1] <a href="http://www.amazon.com/exec/obidos/ASIN/0130319953" rel="nofollow">http://www.amazon.com/exec/obidos/ASIN/0130319953</a>
arebopalmost 15 years ago
Relational databases are no longer fashionable, but they are backed by some great theory and they remain very important in commercial practice. Read <a href="http://philip.greenspun.com/sql/" rel="nofollow">http://philip.greenspun.com/sql/</a> for a quick introduction, but use <a href="http://www.postgresql.org/" rel="nofollow">http://www.postgresql.org/</a> rather than Oracle for the exercises/examples because it's much easier to install.<p>I trust you'll have no shortage of recommendations about CAP, column-based stores, and support for schema flexibility in other comments.
评论 #1427881 未加载
yummyfajitasalmost 15 years ago
Start with SQL. 90% of the time, it is the right choice.<p>Pick any SQL flavor to start, sqlite is probably the easiest.
b0b0b0balmost 15 years ago
I think it depends also on what strengths you already have and how you are personally motivated to learn. For example, I have found java's h2 database to be easy to work with (and you never have to leave java). I don't think any db could be easier to get started with and have less administrative overhead than sqlite. If, to learn how to program computer games, one is advised to first write tetris, to learn programming with databases, you might write a message board.
edw519almost 15 years ago
I always thought that "Database Design for Mere Mortals: A Hands-On Guide to Relational Database Design" by Michael J. Hernandez was a great starting point. Sometimes it's nice to have a real book and you can't go wrong with a used one from Amazon for under 5 bucks.<p><a href="http://www.amazon.com/Database-Design-Mere-Mortals-Hands/dp/0201694719" rel="nofollow">http://www.amazon.com/Database-Design-Mere-Mortals-Hands/dp/...</a>
etraversalmost 15 years ago
I'm probably going to loose the few points I have left, but hey...<p>If you have access to a Windows machine my two cents says get a copy of SQL Server Express. In addition to that you will want a copy of the AdventureWorks database and the SQL Server Books Online.<p>SQL Server Express is a solid and free (as in beer) database engine. There are processor and file size limitations, but other than that it is pretty much the same as every other version they sell.<p>The Books Online (available online or as an installable download) has tutorial style information on every level of the system; database engine, reporting services etc.<p>The AdventureWorks database is a sample database that is used in the BOL and just about every other SQL Server tutorial I have seen. It is quite extensive and will save you from having to create your own data.<p>I'm sure somebody here will try and pick this apart, but this is how I learned. If it means anything, I have been employed as a Databse Analyst for the past four years.<p>They also offer "SQL Server 2008 R2 Update for Developers Training Kit", but I have not tried it. <a href="http://www.microsoft.com/downloads/details.aspx?familyid=FFFAAD6A-0153-4D41-B289-A3ED1D637C0D&#38;displaylang=en" rel="nofollow">http://www.microsoft.com/downloads/details.aspx?familyid=FFF...</a><p>SQL Server Express: <a href="http://www.microsoft.com/sqlserver/2008/en/us/R2Downloads.aspx" rel="nofollow">http://www.microsoft.com/sqlserver/2008/en/us/R2Downloads.as...</a><p>BOL: <a href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&#38;FamilyID=c18bad82-0e5f-4e82-812b-5b23e5d52b9c" rel="nofollow">http://www.microsoft.com/downloads/details.aspx?displaylang=...</a><p>Adventure Works site: <a href="http://sqlserversamples.codeplex.com/" rel="nofollow">http://sqlserversamples.codeplex.com/</a>
thibaut_barrerealmost 15 years ago
If I had to start learning this today (2010), I'd really do a mix of sql (probably mysql) and non-sql (probably mongodb <a href="http://www.learnivore.com/search/mongodb" rel="nofollow">http://www.learnivore.com/search/mongodb</a>).
F_J_Halmost 15 years ago
Although specific to Oracle, any of Tom Kyte's books are invaluable when it comes to learning about databases and how they work.<p>If you do work with Oracle, Tom's "Ask Tom" site is excellent for learning tips and tricks, as well as for finding elegant solutions to tricky SQL problems. Again, it is oracle focused, but still very valuable. Link to Ask Tom:<p><a href="http://asktom.oracle.com/pls/apex/f?p=100:1:0" rel="nofollow">http://asktom.oracle.com/pls/apex/f?p=100:1:0</a>
JangoStevealmost 15 years ago
There are a lot of great suggestions here for learning on your own. I'll just add that if your company/venture will support this learning progress, check out this workshop by Xavier Shay called Your Database Is Your Friend. He travels around the world putting on this workshop, and though I haven't been yet, I've heard good things.<p><a href="http://dbisyourfriend.com/" rel="nofollow">http://dbisyourfriend.com/</a>
grandalfalmost 15 years ago
1) load some data into a table (probably using sqlite) and play around with it using sql<p>2) read up on some database theory<p>3) check out a few popular options: sqlite, mongodb, couchdb and play around a bit more.<p>4) find a big dataset that interests you, load it into one or more of the databases you want to experiment with, and experiment away by trying to extract interesting data, etc. Notice how each one performs, etc.
mtralmost 15 years ago
I don't know what your level is, but I recently used this book to get started on the basics: Beginning Database Design: From Novice to Professional by Clare Churcher<p><a href="http://www.amazon.com/Beginning-Database-Design-Novice-Professional/dp/1590597699" rel="nofollow">http://www.amazon.com/Beginning-Database-Design-Novice-Profe...</a>
fragmedealmost 15 years ago
<a href="http://en.wikipedia.org/wiki/Database_normalization" rel="nofollow">http://en.wikipedia.org/wiki/Database_normalization</a>
michaelfairleyalmost 15 years ago
<a href="http://sol.gfxile.net/galaxql.html" rel="nofollow">http://sol.gfxile.net/galaxql.html</a>
julesalmost 15 years ago
How do database do I/O? Do they use the usual file api? Memory mapped files? Something else?
评论 #1427627 未加载
评论 #1427698 未加载
mkramlichalmost 15 years ago
Google, Wikipedia, get and study the source to some open source databases, etc. How does one start to learn about anything/everything now that we have Internet access? Twenty years ago you would go about something like this starting with a library or a university. Now we still have those things plus the WWW. Knock yourself out.
knownalmost 15 years ago
Spreadsheet is a type of database.
bondalmost 15 years ago
Which is better for a dating site, MyISAM or InnoDB? Thanks.
评论 #1428332 未加载