What is a schema?
In computer programming, a schema (pronounced SKEE-mah) is the organization or structure for a database, while in artificial intelligence (AI) a schema is a formal expression of an inference rule.
For the former, the activity of data modeling leads to a schema. In the latter, a schema is derived from mathematics and is -- essentially -- a generalized axiom or expression where specific values or cases are substituted for symbols in a hypothesis to derive a particular inference.
The word schema originates in the Greek word for form or figure. However, how you specifically define schema depends on context. There are different types of schemas, and their meanings are closely related to fields like data science, education, marketing and SEO (search engine optimization) and psychology.
What is a schema in a database?
A database schema is like a skeletal structure representing a logical view of a whole database. It devises all the constraints applied to the data in a particular database. Whenever organizations engage in data modeling, it leads to a schema.
People often used schema when speaking of both relational databases and object-oriented databases. It also refers to visualizing a structure or a formal text-centric description sometimes.
An architecture or blueprint of how data will appear, a database schema describes the shape of the data and how it relates to other models, tables and databases. In this scenario, a database entry is an instance of the database schema, containing all the properties described in the schema.
A database schema is (generally) broadly divided into two categories: physical database schema that defines how the data-like files are actually stored; and logical database schema, which describes all the logical constraints -- including integrity, tables and views -- applied on the stored data.
Some common database schema examples include the following:
- star schema
- snowflake schema
- fact constellation schema (or galaxy schema)
The star schema is a simple data warehouse diagram that resembles a star. Often used to build data warehouses, a star schema includes one to multiple fact tables and dimensional tables. It uses denormalized data.
![What is a schema? (2) What is a schema? (2)](https://i0.wp.com/cdn.ttgtmedia.com/rms/onlineimages/dm-star_schema-f_mobile.png)
As the name suggests, a snowflake schema is more complex. Even so, the snowflake is a popular database schema because in it, dimension tables are normalized, which can save on storage space and minimize data redundancy.
The fact constellation schema is far more complex than both the star schema and the snowflake schema. It boasts multiple fact tables that share several dimension tables.
![What is a schema? (3) What is a schema? (3)](https://i0.wp.com/cdn.ttgtmedia.com/rms/onlineimages/dm-snowflake_schema-f_mobile.png)
Further explore the difference between snowflake schema and star schema.
What is a schema in SQL?
A SQL database encompasses functions, indexes, tables and views, and there aren't any restrictions when it comes to the number of objects stored within any single database. SQL schemas help define these objects at the logical level. The user that owns that schema is known as the schema owner.
A view in SQL is a virtual table comprised of columns and rows based on the result set of a statement. Foreign keys and primary keys represent the relationships between one table and another.
What is a schema in SEO?
When it comes to search engine optimization (SEO), schemas play a critical role in defining the different entities on a website. This means that schemas help to clearly explain the relationships among people, products and things to web crawlers. By providing this extra content, sites can help search crawlers successfully match search intent with content.
Schemas define the asset type that web crawlers can quickly crawl through without any added visibility or extra context that often leads to latency. This approach also helps enhance search engine results page (SERP) visibility for images, videos, FAQs and more.
Schema markup or labels coded in HTML adds context and shares important information about website pages. It essentially acts as an HTML signpost for spiders that crawl through your content and provide rich snippets in search results.
![What is a schema? (4) What is a schema? (4)](https://i0.wp.com/cdn.ttgtmedia.com/rms/onlineimages/sql_server-schema_defined_depends_context-f_mobile.png)
What is an API schema?
APIs (application programming interfaces) enable disparate pieces of software, services and platforms to share information and interact. Inspired by database schema, an API schema aims to bring that same sort of guide/connectors/descriptors to various aspects of application development to programmers and their APIs.
The creation of API Description Languages (API DL) first enabled API schema, which later led to today's OpenAPI standard. Readable by both humans and machines, API schema describes RESTful API operations and methods for interacting with APIs.
Think of an API schema as a virtual instruction manual amplifying programming processes. It makes APIs easier to use and more discoverable and -- when well executed – enables the creation of SDKs and machine-generated API documentation.
Additional kinds of schema
Education
In education, a schema -- its plural forms are schemas or schemata (often used in academic writing) -- is generally a scheme, plan or diagram. It is a general idea about something that helps students learn.
Psychology
A schema in psychology and other social sciences describes a mental concept. It provides information to an individual about what to expect from diverse experiences and circ*mstances. These schemas are developed and based on life experiences and provide a guide to one's cognitive processes and behavior.
In psychology, there are several types of schemas, including the following:
- event schemas
- object schemas
- person schemas
- self-schemas
- social schemas
Social sciences also use the word schemata to categorize events and objects based on common characteristics and elements that help interpret and predict the world.
This was last updated in May 2021
Continue Reading About schema
Related Terms
- big data management
- Big data management is the organization, administration and governance of large volumes of both structured and unstructured data.Seecompletedefinition
- entity relationship diagram (ERD)
- An entity relationship diagram (ERD), also known as an 'entity relationship model,' is a graphical representation that depicts ...Seecompletedefinition
- serverless database
- A serverless database is a type of cloud database that is fully managed for an organization by a cloud service provider and runs ...Seecompletedefinition