Displaying a Table’s Column Definitions

To use INSERT, UPDATE, or DELETE, you’ll need to know the column definitions of the table whose data you’re modifying, including:

  • The order of the columns in the table

  • Each column’s name

  • Each column’s data type

  • Whether a column is a key (or part of a key)

  • Whether a column’s values must be unique within that column

  • Whether a column permits nulls

  • Each column’s default value (if any)

I gave the column definitions of the sample-database tables in Tables 2.2 through 2.6 in “The Sample Database” in Chapter 2, but you can get the same information by using DBMS tools that describe database objects. In this section, I’ll explain how to use those tools to display column definitions.

To display a table’s column definitions ...

Get SQL: Visual QuickStart Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.