Why use SQL

1st.) I'm still new to C++

so I'm not being condescending, it's a legit question.
I see a lot of post, and walkthroughs mention SQL, but I don't see how/why you would need a server type database to write/store code.

Just wondering if you someone can tell me all the pros/cons and reasons for using SQL

Thanks
SQL = Structured Query Language

It is a standardized syntax for querying information from a relational database. It makes getting information from a database easy.
SQL (and databases in general) provide a way to manage extremely large sets of information in a way that's fast and efficient.

You might think you could avoid using them if you just save your information to a file (or multiple files), but when you have tons and tons of information... this introduces several problems.

1) How many files do you use?
2) How do you split the information across those files?
3) How do you arrange it in a way that's easy to look something up quickly?
4) How can you search for a specific entry quickly?

Consider a situation where you have millions and millions of individual records, each record having dozens of fields, and you need to be able to find all records that match a certain criteria.

Databases provide a way to manage all that data and ways to find/access/modify the data you're looking for in an efficient way.
So how does this differ from IMS? which to my understanding is free.

than SQL that can be from $3,000 to $54,000
SOURCE:
http://www.microsoft.com/sqlserver/2008/en/us/pricing.aspx

Not trying to make an argument for either, just wondering why it's so vital to have SQL. because that is all I see being used.


And queries makes sense, but I don't know how anyone gets millions of files, unless you have a ton of people writing to one central server. I'm just one guy and have 20 programs(.) lol, but maybe that means this just isn't for *me*. yet

Again not arguing, just curious, i apologies because reading through, my questions sound snarky... this is not intended.
Microsoft SQL server is a database server implementation. I personally use the MySQL database server software. It is free. You can deploy on either Windows or Linux (Linux is my preferred platform). There are others as well. SQL is a language (like C++ is a language), not an installable product.
Last edited on
Oh... I was thinking it was like a server OS that was almost exactly like Windows.

Hmmm... Well cool do you mind if I asking where did you get yours? Do the makers have a site, or is it like a filehippo dump thing?
http://www.mysql.com

If you really want to use sql, I recommend going through the tutorial here:

http://www.w3schools.com

I know in Linux, if you install the MySQL development package, it includes headers/libraries so you can access MySQL databases right from your C++ programs!
Last edited on
If you want an example of how you can have so many records, at my company our phone system is Linux based (Asterisk). We log all CDR's to a MySQL database. We have well over a hundred calls in and out everyday. So, you can see how using a standard language to find records that match certain criteria would make the job MUCH easier.
thanks!
If you plan on entering into a professional career as a programmer you will constantly be working with some sort of RDBMS. SQL is the query language used to extract, insert, and manipulate data residing in the database. Storing information in flat files may seem fine, but there is no way to create relationships among data (at least no easy way). Here are some of the more common DBs you'll run into:

DB2, Oracle (PL/SQL), MySQL (SQL), SQL Server (T-SQL)

Oracle will cost you an arm and a leg to purchase and is not a feasible learning option.
MySQL is free and while the latest version of SQL Server - 2008 R2 is pricey, you can grab the express version for free :). My recommendation is downloading SQL Server Express considering SQL Server and Oracle are currently dominating the DB space.
If you want an example of how you can have so many records,


To add onto this.... any kind of business is going to have large quantities of data they need to manage.

You can think of the big guys to get a picture of the most extreme cases.

Examples:

- Think about how many shipments FedEx handles every day. Hell, every hour. They need to have pickup info, tracking number, delivery info, service/speed, approx eta, current shipment status, etc. Depending on how long they keep shipments in their system before purging them, this could easily be in the 10s of millions. That's not counting all the other stuff they need to keep track of... like rate calculations, which locations go to which hubs, registered customer accounts, billing info, etc, etc.

- Any kind of retailer is going to need to keep an inventory of all items in stock, out of stock, pricing, when to order more, etc. Think about all the stuff a large chain like Wal-Mart needs to keep track of for their stores. Wal-Mart also does their own logistics, too, so they have to keep track of all that as well.
Topic archived. No new replies allowed.