Online Trainers for SQL

What is a relational database?

relational database (RDB) is a collective set of multiple data sets organized by tablesrecords and columns. RDBs establish a well-defined relationship between database tables. Tables communicate and share information, which facilitates data searchability, organization and reporting.

RDBs use Structured Query Language (SQL), which is a standard user application that provides an easy programming interface for database interaction.

Relational databases are based on the relational modelan intuitive, straightforward way of representing data in tables. In a relational database, each row in the table is a record with a unique ID called the key. The columns of the table hold attributes of the data, and each record usually has a value for each attribute, making it easy to establish the relationships among data points.

Benefits of Relational Databases:

  • Data Consistency
  • Commitment and Atomicity
  • Stored Procedures and Relational Databases
  • Database Locking and Concurrency

Relational Database Terms

Below are the unique terms and specific definitions that will help you understand what a RDB can do and how it works:

Row : A set of data constituting a single item.

For example, the data for a single employee (e.g. first name, last name, employee ID, hire date, work location, etc.) of a company would be displayed in a row. A row can also be called a record, an entity, or a tuple.

Column: Labels for elements of rows. A column gives context to the information contained in rows. For an employee database, the column headers could be the items listed above for employees. A column is also known as an attribute or a field.

Table: A group of rows that match the parameters set up for the table. The data in a table must all be related. An employee database may have separate tables for active employees, retired employees, and former employees. A table is also known as a relation or base revelar.

View: A set of data based on a query via the RDBMS; also known as result set or derived revelar.

Domain: The set of possible values for a given column. For example, the phone number and ZIP code columns would be numbers, while first and last names would be limited to letters.

Constraint: A narrowing of a domain. For example, the domain of the work location on a employee record would be alphanumeric, but it could be restricted to a predefined list rather than being a free-form field. The phone number field would be constrained to 10 digits.

Primary key: The unique identifier of a row in a table.

Foreign key: The unique identifier of a row in another table.

Distributed Database: A database that stores data in multiple locations, rather than on a single hard drive or server.

TYPES OF DATABASE RELATIONSHIPS

The power of a relational database is in the links and relations. By connecting rows in different tables through the use of primary and foreign keys, you can create views, reports, and other slices of information to serve your organization. There are three primary types of database relationships:

One-to-One: One row in one table is connected to one and only one row in another table. For example, a Social Security number is linked to a single employee.

One-to-Many: One row in one table is connected to zero, one, or more than one rows in another table. For example, one work location can be linked to many employees.

Many-to-Many: Zero, one, or many rows in one table are linked to zero, one, or many rows in another table. For example, multiple employees can be assigned to multiple projects.