sqlansi-sql

How to specify the schema prefix of a table in ANSI SQL?


In order to SELECT from a table, the table name is specified in ANSI SQL as follows:

SELECT * FROM "My Table"

I was wondering if there is an ANSI SQL rule on how to specify the schema name of a table. Something like:

SELECT * FROM "My Schema"."My Table"

On SQL Server, it would be:

SELECT * FROM [My Schema].[My Table]

but this is obviously not ANSI SQL but T-SQL.


Solution

  • The Standard SQL way is

    SELECT * FROM "My Schema"."My Table"
    

    Caution: Double quoted names are case sensitive, so they're are not really recommended.