How to Implement a Database in MySQL for HTML5 and CSS3 Programming
How to Use SQL with Microsoft Access
How to Run a Script with phpMyAdmin in SQL for HTML5and CSS3 Programming

How to Collect Tables into Schemas with SQL

A table consists of rows and columns and usually deals with a specific type of entity in SQL, such as customers, products, or invoices. Useful work generally requires information about several (or many) related entities. Organizationally, you collect the tables that you associate with these entities according to a logical schema. A logical schema is the organizational structure of a collection of related tables.

A database also has a physical schema — which represents the physical arrangement of the data and its associated items (such as indexes) on the system’s storage devices. When you seethe phrase “the schema” of a database, it refers to the logical schema, not the physical schema.

On a system where several unrelated projects may co-reside, you can assign all related tables to one schema. You can collect other groups of tables into schemas of their own.

Be sure to name your schemas to ensure that no one accidentally mixes tables from one project with tables from another. Each project has its own associated schema; you can distinguish it from other schemas by name. Seeing certain table names (such as CUSTOMER, PRODUCT, and so on) appear in multiple projects, however, is common.

If any chance exists of a naming ambiguity, qualify your table name by using its schema name as well (as in SCHEMA_NAME.TABLE_NAME). If you don’t qualify a table name, SQL assigns that table to the default schema.

  • Add a Comment
  • Print
  • Share
blog comments powered by Disqus
How to Calculate Date Values in SQL Data for HTML5and CSS3 Programming
How to Use SIMILAR and NULL Predicates in SQL Statements
How to Use SQL Predicates
How to Use WHERE Clauses in SQL
How to Use CAST Data-Type Conversions with SQL
Advertisement

Inside Dummies.com