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
41
votes
3 answers

TSQL Define Temp Table (or table variable) Without Defining Schema?

Is there a way to define a temp table without defining it's schema up front?
Jeff
  • 8,020
  • 34
  • 99
  • 157
41
votes
3 answers

SQL server schema and default schema

I have a schema define in my database. Except now everytime I do a sql statement I have to provide the schema ... SELECT * FROM [myschema].table I set the default schema for my user using management studio and also ran the ALTER USER myUser WITH…
pdiddy
  • 6,217
  • 10
  • 50
  • 111
40
votes
5 answers

Import and export schema in cassandra

How to import and export schema from Cassandra or Cassandra cqlsh prompt?
vpggopal
  • 437
  • 1
  • 4
  • 3
40
votes
3 answers

How to view current database schema for Heroku app in Terminal?

I am trying to view my Heroku app's schema in Terminal (Mac OS X Lion) and stumbled upon a command that does just that. In Terminal, I run heroku run more db/schema.rb but it seems to display an older schema version. I just migrated the Heroku db…
vich
  • 11,836
  • 13
  • 49
  • 66
39
votes
3 answers

Database schema for organizing historical stock data

I'm creating a database schema for storing historical stock data. I currently have a schema as show below. My requirements are to store "bar data" (date, open, high, low, close volume) for multiple stock symbols. Each symbol might also have…
nall
  • 15,899
  • 4
  • 61
  • 65
39
votes
2 answers

MODIFY COLUMN in oracle - How to check if a column is nullable before setting to nullable?

I'm trying to fill in for a colleague in doing some Oracle work, and ran into a snag. In attempting to write a script to modify a column to nullable, I ran into the lovely ORA-01451 error: ORA-01451: column to be modified to NULL cannot be modified…
Jay S
  • 7,904
  • 2
  • 39
  • 52
38
votes
6 answers

Find SQLite Column Names in Empty Table

For kicks I'm writing a "schema documentation" tool that generates a description of the tables and relationships in a database. I'm currently shimming it to work with SQLite. I've managed to extract the names of all the tables in a SQLite database…
Drew Hall
  • 28,429
  • 12
  • 61
  • 81
38
votes
4 answers

Why do we specify namespace in android xml file?

When we write a xml based layout in Android we use the string "xmlns:android="http://schemas.android.com/apk/res/android". From the books I read it says that this is a namespace, but why do we use this? The link doesn't even exist. So what is the…
Vinoth
  • 5,687
  • 11
  • 44
  • 56
38
votes
2 answers

What are some GraphQL schema naming best practices?

I'm beginning development on a nontrivial application for which we're considering GraphQL. When working on the initial draft of our schema, I've become a bit paralyzed trying to establish naming conventions that will scale as the product matures. I…
Mike Marcacci
  • 1,913
  • 1
  • 18
  • 24
37
votes
5 answers

Where are the schemas for XML files on an Android project?

Where are the schemas (DTD or XML schema) for the XML files used on Android like AndroidManifest.xml or the layouts?
Pablo Fernandez
  • 279,434
  • 135
  • 377
  • 622
37
votes
5 answers

Database schema for chat: private and group

I'm trying to design the database schema with the ability to both private chat and group chat. Here's what I've got so far: So - the theory is that even if the user is just in a one on one private chat, they are still assigned a 'roomID', and each…
Chud37
  • 4,907
  • 13
  • 64
  • 116
37
votes
1 answer

XML Namespace URI with HTTPS?

Is it better to have a xmlns URI with https protocol? For example this is the recommended way by the manual: Is it legal and better to use this way?
kavai77
  • 6,282
  • 7
  • 33
  • 48
37
votes
11 answers

Mongoose: extending schemas

Currently I have two almost identical schemas: var userSchema = mongoose.Schema({ email: {type: String, unique: true, required: true, validate: emailValidator}, passwordHash: {type: String, required: true}, firstname: {type: String,…
Tom
  • 8,536
  • 31
  • 133
  • 232
37
votes
2 answers

MongoDB: How to represent a schema diagram in a thesis?

I am currently writing a thesis and need to display the schema of my MongoDB in a diagram. I have found no resources about diagrams for document-based databases. There are Entity Relationship Diagrams (ERD) for relational databases. What options do…
Andrew
  • 896
  • 2
  • 12
  • 31
36
votes
3 answers

Mongoose Subdocuments in Nest.js

I'm moving my app from express.js to Nest.js, and I can't find a way to reference one mongoose Schema in another, without using old way of declaring Schema with mongoose.Schema({...}). Let's use example from docs, so I can clarify my…
LBeerus
  • 391
  • 1
  • 3
  • 7