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
48
votes
2 answers

Escaping Regex to get Valid JSON

In my schema, I want to recognize certain patterns to restrict the type of data that a user can enter. I use regex to restrict what a user can enter, but the regex get flagged when I try to validate the JSON using an online validator like this one.…
goldisfine
  • 4,742
  • 11
  • 59
  • 83
48
votes
4 answers

What is the difference between Type and Element in WSDL?

In WSDL file a function can return a Type or an Element. I have used only custom types as a results so far. However, I wonder when the Element should be more appropriate than the Type? What is the difference between them? Is there any difference…
czuk
  • 6,218
  • 10
  • 36
  • 47
47
votes
4 answers

Why don't most vim color schemes look as nice as the screenshot when I use them?

I have downloaded many vim color schemas and tried them out, but many of them don't look like the official screenshot. For example, vim's own color schema - desert should look like this: But in my vim, many colors won't display, for example the…
Tanky Woo
  • 4,906
  • 9
  • 44
  • 75
47
votes
10 answers

How to join query in mongodb?

I have user document collection like this: User { id:"001" name:"John", age:30, friends:["userId1","userId2","userId3"....] } A user has many friends, I have the following query in SQL: select * from user where in (select friends from…
L.J.W
  • 1,575
  • 5
  • 18
  • 24
47
votes
3 answers

Creating a multi-tenant application using PostgreSQL's schemas and Rails

Stuff I've already figured out I'm learning how to create a multi-tenant application in Rails that serves data from different schemas based on what domain or subdomain is used to view the application. I already have a few concerns answered: How can…
Ramon Tayag
  • 15,224
  • 9
  • 43
  • 69
47
votes
2 answers

Execute .sql schema in psycopg2 in Python

I have a PostgreSQL schema stored in .sql file. It looks something like: CREATE TABLE IF NOT EXISTS users ( id INTEGER PRIMARY KEY, facebook_id TEXT NOT NULL, name TEXT NOT NULL, access_token TEXT, created INTEGER NOT…
linkyndy
  • 17,038
  • 20
  • 114
  • 194
46
votes
4 answers

Differences between Database and Schema using different databases?

What are the differences in database terminology between MS SQL and MySQL? Can a MySQL instance have more than one database? It appears that it can only create different schemas. However, the SQL command is create database. In MS SQL, you can create…
user48545
  • 3,291
  • 9
  • 31
  • 42
45
votes
1 answer

How to manage multiple JSON schema files?

I'm trying to validate my JSON API using node.js + json-schema.js from commonjs-utils. Just single validation was easy but could not find right way how to manage multiple schema files to enable referencing each other. Suppose that I got two Models &…
Ray Yun
  • 1,571
  • 3
  • 16
  • 22
44
votes
5 answers

How to get the schema definition from a dataframe in PySpark?

In PySpark it you can define a schema and read data sources with this pre-defined schema, e. g.: Schema = StructType([ StructField("temperature", DoubleType(), True), StructField("temperature_unit", StringType(), True), …
Hauke Mallow
  • 2,887
  • 3
  • 11
  • 29
44
votes
10 answers

How should I visualize the structure of my code?

I have an application written in Java. In is stored in several files. It uses different classes with different methods. The code is big and complicated. I think it would be easier to understand the code if I have a graphical model of the code (some…
Roman
  • 124,451
  • 167
  • 349
  • 456
43
votes
2 answers

Using RegEx in JSON Schema

Trying to write a JSON schema that uses RegEx to validate a value of an item. Have an item named progBinaryName whose value should adhrere to this RegEx string "^[A-Za-z0-9 -_]+_Prog\\.(exe|EXE)$". Can not find any tutorials or examples that…
Destroyer
  • 639
  • 1
  • 7
  • 13
42
votes
4 answers

TypeScript interface with XOR, {bar:string} xor {can:number}

How do I say that I want an interface to be one or the other, but not both or neither? interface IFoo { bar: string /*^XOR^*/ can: number; }
A T
  • 13,008
  • 21
  • 97
  • 158
42
votes
2 answers

What is the use of mongoose methods and statics?

What is the use of mongoose methods and statics and how are they different from normal functions? Can anyone explain the difference with example.
iiR
  • 707
  • 1
  • 6
  • 21
42
votes
9 answers

Is there a performance decrease if there are too many columns in a table?

Is there a performance cost to having large numbers of columns in a table, aside from the increase in the total amount of data? If so, would splitting the table into a few smaller ones help the situation?
Richard Knop
  • 81,041
  • 149
  • 392
  • 552
42
votes
5 answers

where to find xsd.exe in visual studio 2013 on windows 8

I have used the xsd.exe utility in Visual Studio 2003 and 2008 to generate typed datasets from a 3rd party XSD file. The third party has changed their schema so I need to regenerate the datasets but I can't find XSD.EXE. The win8 search gives me…
user3010967
  • 421
  • 1
  • 4
  • 3