SQL : Compare Hosting

Compare 1685 hosting plans from 460 webhosts from our reviews section. Use the control panel (on the left) to start searching. Results will automatically update.

Oops! No Hosting Plans Match Your Search

You've selected a combination of features that none of the web hosts we profile offer. We suggest you remove your last filter or reset & start again.

Ask Our Experts

Need help with your hosting? Tell us exactly what you are looking for and we’ll do our very best to help. Please allow one working day for a response.

Please fill in all fields.

Thanks! Your request has been sent. We'll reply within 24 hours.

Relational Databases & SQL

All websites require some way to store content and data. The earliest websites didn’t make a distinction between content and presentation, and so content was simply stored in pages or documents, which were accessed by a web browser.

As the websites became more complex, and the technology to deal with this complexity advanced, content was separated from presentation. Content is now usually held in some form of a distinct data store. More often than not, this is a Relational Database.

Relational Database Basics

A relational database stores information in tables. Generally, there is a table for each class of “real” things which you are trying to keep track of. For example, in a library database, there would be a table for Books and a table for Authors (among many others).

Each row of a table represents one instance of that class — a single book, or a single author. Each column of the table is an attribute — title, year published.

The database is called “relational” because the tables can be related to each other. For example, authors are related to books in that each book has an author. So a column on the Books table might be “Author,” and the contents of that column would be references to rows on the Authors table (that is, reference to specific authors).

References are made by the use of Unique Keys and Foreign Keys. Each row on the Authors table (and every other table as well) has a Unique ID, usually a number. In the author column on the Books table, the attribute for author isn’t stored as the author’s name, but rather as a numerical reference to the appropriate row on the Authors table.

This way of referencing rows in other tables helps enforce the rule of “Single Source of Truth.” The Authors table holds all information about the Author, including how his or her name is spelled. If a change needs to be made, the change is made in only one place, and the referring rows don’t have to make any changes.

Data modeling in relational databases

The art and science of designing a database — deciding what tables are needed and how they will relate to each other — is called data modeling. And it’s more difficult than it may initially seem.

For example, let’s explore this library database further.

Should there really be a table for Books? A library might have several different types of media available. Should there be a table for Books and a separate one for Magazines, DVDs, Manuscripts, and CDs? Probably not. A more sensible design would probably be to have a table called Items, which includes as an attribute a column called media or type. This would then be a Foreign-Key reference to a table that enumerates the different types of media (books, magazines, DVDs, etc.).

What about Authors? Should there be a table for Authors? What about cast members in movies, publishers of magazines, producers of albums? If someone has done all those different things for different projects, should they show up in four or five different tables?

That would violate Single Source of Truth.

Maybe we should just have a table called People. But then, what about the author column on the Books (Items) table? What if a book has more than one author? What if a book has an editor, but no single author (like a collection of poetry)?

The standard solution here is to have a table that defines a relationship between Items and People, perhaps called Contributers. This would have three columns — item, person, and role. Role would then need to be a Foreign Key reference to a table which enumerates the different possible roles a person might have — author, editor, producer, actor, singer.

With data modeling, each piece of the puzzle — each “real-world” class of items you need to keep track of — creates a layer of potential complexity. Good data modeling is a process of finding the simplest solution which will allow for a maintainable and consistent dataset, in which any possible question about the data can have one and only one answer.

What kind of relationships exist between database tables? There are three kinds of relationships between tables. The most basic is the one-to-many relationship. In our phone call database, there is a one-to-many relationship between calls and caller tables. A single caller can show up any number of times in the calls table.

The one-to-one relationship is just what it sounds like. It is rarely used, because it is just a way of separating what would normally be a single table into two tables. But it is occasional used when there are a lot of data elements that are rarely accessed.

The many-to-many relationship is where there are many corresponding items in each table. And example of this would occur in our call log if there were conference calls with more than one caller for a single call. This is managed in database design by creating an intermediary table. This new table then has a one-to-many relationship with the two tables it is linking.

SQL

Most relational databases — and all relational databases which are popular for web applications — use SQL, the Structured Query Language. SQL provides a set of commands for manipulating tables (designing the database) and retrieving information (running queries).

Even though all SQL databases use the same query language for programming, each database management system implements the storage and management layers differently, which means that each has particular strengths and weaknesses in the area of performance of different types of queries.

Popular SQL Relational Database Management Systems

  • MySQL — Probably the most popular RDBMS for web applications, owing to its use in WordPress, Drupal, Joomla, and several other PHP-based web applications.
  • MariaDB — Drop-in replacement for MySQL with improved performance.
  • MS Access — Desktop database application-building tool. Not generally considered appropriate for web use.
  • MSSQL — Microsoft’s SQL Server, an RDBMS for use with other Microsoft applications and tools such as Sharepoint and .NET
  • PostgreSQL — Community Open Source database, seen by many as a better alternative to MySQL.
  • SQLite — Database-management library that can be included into applications. Stores databases as files. Useful for prototyping and embedded applications.

Frequently Asked Questions

WhoIsHostingThis Recommends

★★★★
Support
★★★★
Features
★★★★
Uptime
★★★★
Value
★★★★

Pros: Free domain name , Unlimited traffic, emails, DBs

Cons: No Windows-based plans

SiteGround is an established web host managing well over 1,000 servers and... Read more

Visit host

2. iPage

ipage logo
★★★★
Support
★★★★
Features
★★★★
Uptime
★★★★
Value
★★★★

Pros: Unlimited Disk Space, Bandwidth & Email , Unlimited MySQL Databases

Based in the US, iPage specialises in low-cost shared hosting. Each plan... Read more

Visit host
★★★
Support
★★★
Features
★★★★
Uptime
★★★
Value
★★★

Pros: Free Domain , Unlimited Bandwidth

Bluehost provides customers with low-cost shared hosting, as well as reseller, VPS... Read more

Visit host

Updating...