SQL Keywords

SQL YES

What is SQL YES?

YES is a non-reserved literal string most commonly returned by INFORMATION_SCHEMA views to denote an affirmative (true) property, such as a column being nullable.
Sign up to get up to date news on SQL keywords
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

Compatible dialects for SQL YES: PostgreSQL, MySQL, MariaDB, SQL Server, Oracle, Snowflake, Redshift, BigQuery (within INFORMATION_SCHEMA)

SQL YES Full Explanation

YES is not a reserved keyword in the SQL language itself. Instead, it is a string value defined by the SQL standard’s INFORMATION_SCHEMA views. Many metadata columns that describe a boolean capability (nullable, updatable, insertable, etc.) return the literal strings YES or NO instead of using a BOOLEAN data type. Because the columns are declared as CHARACTER or VARCHAR, the database engine treats YES like any other string, so it must be quoted in predicates. The presence of YES indicates that the property in question applies: a column can accept NULLs, a table is insert-able, or a view is updatable. The exact set of metadata columns using YES/NO varies by database, but the semantics remain the same. YES is read-only metadata; you cannot assign it directly to alter behavior. Attempting to use YES as an unquoted identifier or constant in DML statements will raise an error in most dialects. When filtering metadata, always compare against the string 'YES' (case insensitive in most systems) and remember that it represents informational state, not a true boolean type.

SQL YES Syntax

YES

SQL YES Parameters

Example Queries Using SQL YES

--Find all nullable columns in the users table
SELECT column_name, data_type
FROM information_schema.columns
WHERE table_schema = 'public'
  AND table_name   = 'users'
  AND is_nullable  = 'YES';

--List views that can be updated directly
SELECT table_name
FROM information_schema.views
WHERE is_updatable = 'YES';

Expected Output Using SQL YES

  • Queries return rows where the metadata column equals 'YES'
  • Other rows show 'NO'
  • No data is modified

Use Cases with SQL YES

  • Auditing schema to find columns that allow NULLs
  • Validating which views are updatable before writing DML
  • Building data-governance reports that list insertable tables
  • Generating migration scripts that change nullable columns to NOT NULL

Common Mistakes with SQL YES

  • Forgetting to quote YES in predicates (is_nullable = YES) which causes an unknown-column error
  • Assuming YES is a BOOLEAN literal interchangeable with TRUE
  • Expecting every database flag column to use YES/NO instead of 1/0 or TRUE/FALSE

Related Topics

SQL NO, INFORMATION_SCHEMA, BOOLEAN, IS_NULLABLE, IS_UPDATABLE

First Introduced In

SQL-92 (initial INFORMATION_SCHEMA definition)

Frequently Asked Questions

What does YES mean in INFORMATION_SCHEMA?

YES signifies that the metadata condition is true. For instance, IS_NULLABLE = 'YES' signals the column can store NULL values.

Is YES a reserved SQL keyword?

No. It is simply a string literal used in metadata views. You must quote it when using it in predicates.

Can I use YES instead of TRUE in a WHERE clause?

Generally no. Most dialects do not treat YES as a boolean literal, so WHERE active = YES will fail. Use TRUE or 1 depending on the database.

Why do metadata views use YES/NO instead of BOOLEAN?

The SQL-92 standard defined metadata columns as character strings for maximum portability. Many engines kept that design for backward compatibility.

Sign up to get up to date news on SQL keywords
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.
Trusted by top engineers on high-velocity teams
Aryeo Logo
Assort Health
Curri
Rubie Logo
Bauhealth Logo
Truvideo Logo

Check out other commonly used SQL Keywords!