Questions tagged [schema]

Schema means shape, or more generally, plan. It may be XML schema or Database schema.

XML schema

An XML schema is a description of a type of XML document, typically expressed in terms of constraints on the structure and content of documents of that type, above and beyond the basic syntactical constraints imposed by XML itself.

These constraints are generally expressed using some combination of grammatical rules governing the order of elements, Boolean predicates that the content must satisfy, data types governing the content of elements and attributes, and more specialized rules such as uniqueness and referential integrity constraints.

There are languages developed specifically to express XML schemas. The Document Type Definition (DTD) language, which is native to the XML specification, is a schema language that is of relatively limited capability, but that also has other uses in XML aside from the expression of schemas. Two more expressive XML schema languages in widespread use are XML Schema (with a capital S) and RELAX NG.

The mechanism for associating an XML document with a schema varies according to the schema language. The association may be achieved via markup within the XML document itself, or via some external means.

More info about XML schema

Database schema

A database schema of a database system is its structure described in a formal language supported by the database management system (DBMS) and refers to the organization of data to create a blueprint of how a database will be constructed (divided into database tables).

The formal definition of database schema is a set of formulas (sentences) called integrity constraints imposed on a database. These integrity constraints ensure compatibility between parts of the schema. All constraints are expressible in the same language. A database can be considered a structure in realization of the database language. The states of a created conceptual schema are transformed into an explicit mapping, the database schema. This describes how real world entities are modeled in the database.

A schema can contain formulas representing integrity constraints specifically for an application and the constraints specifically for a type of database, all expressed in the same database language.

In a relational database, the schema defines the tables, fields, relationships, views, indexes, packages, procedures, functions, queues, triggers, types, sequences, materialized views, synonyms, database links, directories, Java, XML schemas, and other elements.

More info about Database schema

References:

7547 questions
176
votes
9 answers

How can I export the schema of a database in PostgreSQL?

My computer broke down but fortunately I backed up the folder C:\Program Files\PostgreSQL. Now I'm working in a new computer and I would like to import the previous Postgres databases that are stored in the external disk. I would like to export the…
programmer
  • 4,571
  • 13
  • 49
  • 59
171
votes
6 answers

How to define object in array in Mongoose schema correctly with 2d geo index

I'm currently having problems in creating a schema for the document below. The response from the server always returns the "trk" field values as [Object]. Somehow I have no idea how this should work, as I tried at least all approaches which made…
niels_h
  • 1,869
  • 2
  • 13
  • 15
151
votes
10 answers

Any tools to generate an XSD schema from an XML instance document?

I am looking for a tool which will take an XML instance document and output a corresponding XSD schema. I certainly recognize that the generated XSD schema will be limited when compared to creating a schema by hand (it probably won't handle optional…
Matt Dillard
  • 14,677
  • 7
  • 51
  • 61
151
votes
20 answers

Good tool to visualise database schema?

Are there any good tools for visualising a pre-existing database schema? I'm using MySQL if it matters. I'm currently using MySQL Workbench to process an SQL create script dump, but it's clunky, slow and a manual process to drag all the tables about…
Mat
  • 82,161
  • 34
  • 89
  • 109
136
votes
16 answers

How do you version your database schema?

How do you prepare your SQL deltas? do you manually save each schema-changing SQL to a delta folder, or do you have some kind of an automated diffing process? I am interested in conventions for versioning database schema along with the source code.…
Eran Galperin
  • 86,251
  • 24
  • 115
  • 132
132
votes
2 answers

What's the difference between a catalog and a schema in a relational database?

I used to think schema were the "upper wrapper" object before the database itself. I mean DB.schema.. Well, the catalog "wrapper" is now quite confusing. Why should we need a catalog? For what purpose, precisely…
Stephan
  • 41,764
  • 65
  • 238
  • 329
128
votes
7 answers

How do I query if a database schema exists

As part of our build process we run a database update script as we deploy code to 4 different environments. Further, since the same query will get added to until we drop a release into production it has to be able to run multiple times on a given…
Pulsehead
  • 5,050
  • 9
  • 33
  • 37
123
votes
14 answers

Get GraphQL whole schema query

I want to get the schema from the server. I can get all entities with the types but I'm unable to get the properties. Getting all types: query { __schema { queryType { fields { name type { kind ofType…
Aleksandrenko
  • 2,987
  • 6
  • 28
  • 34
123
votes
11 answers

How do I change db schema to dbo

I imported a bunch of tables from an old sql server (2000) to my 2008 database. All the imported tables are prefixed with my username, for example: jonathan.MovieData. In the table properties it lists jonathan as the db schema. When I write…
jonathan hall
  • 1,386
  • 3
  • 10
  • 7
117
votes
10 answers

How to create an empty DataFrame with a specified schema?

I want to create on DataFrame with a specified schema in Scala. I have tried to use JSON read (I mean reading empty file) but I don't think that's the best practice.
user1735076
  • 3,225
  • 7
  • 19
  • 16
116
votes
9 answers

Which SchemaType in Mongoose is Best for Timestamp?

I'm using Mongoose, MongoDB, and Node. I would like to define a schema where one of its fields is a date\timestamp. I would like to use this field in order to return all of the records that have been updated in the last 5 minutes. Due to the fact…
Liatz
  • 4,997
  • 7
  • 28
  • 33
107
votes
3 answers

MongoDB Schema Design - Many small documents or fewer large documents?

Background I'm prototyping a conversion from our RDBMS database to MongoDB. While denormalizing, it seems as if I have two choices, one which leads to many (millions) of smaller documents or one which leads to fewer (hundreds of thousands) large…
Andre
  • 1,601
  • 3
  • 15
  • 15
102
votes
5 answers

Yup schema validation password and confirmPassword doesn't work

import * as Yup from 'yup'; import User from '../models/User'; class UserController { async store(req, res) { const schema = Yup.object().shape({ name: Yup.string().required(), email: Yup.string() .email() .required(), password:…
Player Josu
  • 1,133
  • 2
  • 6
  • 6
102
votes
6 answers

YAML Schema Validation?

Is there a schema validation language for YAML? I've googled but couldn't find anything useful. Something like XSD format, using the language itself to describe the schema, would be the best choice in my case.
Klaim
  • 67,274
  • 36
  • 133
  • 188
94
votes
9 answers

How can I tell jaxb / Maven to generate multiple schema packages?

Example: org.jvnet.jaxb2.maven2 maven-jaxb2-plugin 0.7.1
M.R.
  • 1,959
  • 4
  • 24
  • 32