You can think of it as another logical layer that groups objects inside of a database. So tables, views, functions etc. logically don't belong to the database directly, but to a schema, so you can have objects with the same names in different schemas within a database. Even if you don't create or specify a schema yourself, most databases revert to a "default" schema that is created with the database ["public" for PostgreSQL or "dbo" for SQL Server].
Users, however, are usually created on the database level [they are "owned" by the database whereas e.g. tables are "owned" by the schema], so you can also use schemas to orgnanize access to objects between users by giving users permissions on some schemas and not others.
Recent Interview Questions | Search | Subscribe [RSS]
INTERVIEW QUESTION:
ANSWER
An XML Schema is a document that is itself described using XML and which defines how an XML document must be structured in order to conform to structured required by the a system or service which references the XML Schema. Specifically it defines:
- The elements that may appear
- The attributes that may appear for each element
- Which elements are child elements
- The order in which child elements must appear
- The number of child elements that may appear
- The data types for each element or attribute
- Default values and constant value for elements and attributes
- Minimum and maximum occurrences of an element
The term DTD [Document Type Definition] is often used when discussing the acceptable form of XML documents. However, XML Schemas are successors to XML DTDs and have a number of benefits over DTDs. Some of these benefits are:
- Schemas are written in XML
- Schemas may be extended to future additions
- Schemas contain a richer set of rules to which data must conform
- Schemas make it easier to validate correctness of data
- Schemas support data types
XML schemas are able to enforce specific rules and data conformity such as:
- Data Types – data conforms to a specific data type [string, date, numeric, boolean, etc]
- Value restrictions – data conforms to the acceptable values [enumeration, fractionDigits, length, maxExclusive, maxInclusive, maxLength, minExclusive, minInclusive, minLength, pattern, totalDigits, whitespace, etc]
- Element Indicators – elements conform to specific indicators [Order Indicators, Occurance Indicators, and Group Indicators] which apply rules to how many elements must appear, in what order, or adhering to a specific structure [maxOccurs, minOccurs, all, choice, sequence, etc].
Sample XML Schema
Sample XML which conforms to Schema
Joseph
Smith
Brian
James
56
ADDITIONAL ANSWERS / COMMENTS
Only registered users may post comments.