The table contains columns for data about first name, last name, and hair color, plus an id column that was created to uniquely identify each row, regardless of whether or not the values in the other columns were unique.
The id column of the friends table is an example of a primary key. A primary key is used to uniquely identify a row in the same table. Columns can be explicitly specified as primary keys in PostgreSQL using PRIMARY KEY , as was done when the column was created in the previous article:
ALTER TABLE friends
ADD COLUMN id serial PRIMARY KEY;
A primary key is usually, though not always, an automatically-incrementing integer. But no matter the data type, a primary key must be unique, and so surrogate keys make great primary keys.
Keys are values that uniquely identify a single row in a database table. They are necessary because it is highly possible that a table will have two rows that contain identical data but represent two separate entities in the real world.
Let’s say we wanted to create a table in PostgreSQL to store information about our friends. The schema for this table might be created with the following code:
CREATE TABLE friends(
This table has two text columns, one for first name and one for last name. Now let’s populate our table with some data:
Recently, I helped a friend with her website. I had just spent the whole day staring at a computer screen, and my eyes were tired. So the first thing I noticed was the contrast between the body text and the background…or rather, the lack thereof.
The page looked something like this:
I have made many similar color decisions myself in the past. When I first started making websites, choosing the colors was my favorite part. The only criterion I used to decide colors for text and background was, “does it look pretty?”
What I didn’t realize at that point was that color choice can make a website difficult to read, and even exclude users from being able to view a website at all.
Web Content Accessibility Guidelines (WCAG)
The Web Accessibility Initiative (WAI) of the World Wide Web Consortium (W3C) has published a set of standards for web content, called the the Web Content Accessibility Guidelines (WCAG for short). Within this document are standards for just about every aspect of web content, including colors, images, video, text, and documents.