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

PostgreSQL: Create schema in specific database

I need to write an sql script that creates both a new database AND a new schema in the database I just created. How can I do it? Can I somehow change the current database to the new one? Or can I somehow specify the database for CREATE SCHEMA? I'm…
Axel Fontaine
  • 34,542
  • 16
  • 106
  • 137
91
votes
5 answers

How to create a new schema/new user in Oracle Database 11g?

I have applied for an internship in a company and as a question they have asked me to create a schema for their company with certain requirements and mail them the DDL file. I have installed Oracle database 11g Express edition, but how do I create a…
acoder
  • 1,045
  • 1
  • 8
  • 5
83
votes
6 answers

targetNamespace and xmlns without prefix, what is the difference?

In an xml schema document, if I have both the targetNamespace and the xmlns without a prefix. What is the exact…
Abe
  • 8,623
  • 10
  • 50
  • 74
78
votes
10 answers

What are XML namespaces for?

This is something that I always find a bit hard to explain to others: Why do XML namespaces exist? When should we use them and when should we not? What are the common pitfalls when working with namespaces in XML? Also, how do they relate to XML…
Doron Yaacoby
  • 9,412
  • 8
  • 48
  • 59
77
votes
8 answers

set default schema for a sql query

Is there a way to set the schema for a query so that in the rest of the query I can refer to tables just by their name without prepending them with a schema name? For instance, I would like to do something like this: Use [schemaName] select * from…
CatDadCode
  • 58,507
  • 61
  • 212
  • 318
70
votes
1 answer

Does rake db:schema:dump recreate schema.rb from migrations or the database itself?

Does rake db:schema:dump recreate schema.rb from migrations or the database itself?
pingu
  • 8,719
  • 12
  • 50
  • 84
70
votes
10 answers

XML Attributes vs Elements

When should you use XML attributes and when should you use XML elements? e.g. or foo
user23726
  • 717
  • 1
  • 5
  • 3
68
votes
4 answers

unable to marshal type as an element because it is missing an @XmlRootElement annotation for auto generated classes

I need to validate Class object against my schema in which I have provided regular expression to validate fields for auto generated JAXB classes. When I try to validate my class object I get below error: unable to marshal type "xyz" as an element…
user656213
  • 993
  • 2
  • 8
  • 10
66
votes
8 answers

Seed multiple rows at once laravel 5

I'm currently trying to seed my users table. If I try it like this with 2 rows, it fails. It works fine if I just use a single array instead of the 2 arrays inside the $users array to create some fake data. What am I doing wrong, what is the proper…
Stephan-v
  • 19,255
  • 31
  • 115
  • 201
64
votes
2 answers

How does the search_path influence identifier resolution and the "current schema"

Is it possible to define in which schema new tables get created by default? (Referred by "unqualified table names".) I've seen some details about using the "search path" in Postgres, but I think it only works while retrieving data, not creating. I…
thyandrecardoso
  • 801
  • 1
  • 7
  • 12
64
votes
6 answers

add_column for references (Rails)

I have the following Rails migration which works perfectly (irrelevant pieces removed): create_table :comments do |t| t.text :body t.references :post end Now I'd like to add an author column to my comments table (which is the userid of a user),…
Dan Rosenstark
  • 68,471
  • 58
  • 283
  • 421
64
votes
13 answers

Log4Net "Could not find schema information" messages

I decided to use log4net as a logger for a new webservice project. Everything is working fine, but I get a lot of messages like the one below, for every log4net tag I am using in my web.config: Could not find schema information for the element…
xsl
  • 17,116
  • 18
  • 71
  • 112
62
votes
6 answers

Load a structure.sql into a rails database via rake

rake db:schema:load will load a schema.rb file into a rails database. Is there a way to load a structure.sql file into the database through rake or do I just need to do this manually?
locoboy
  • 38,002
  • 70
  • 184
  • 260
61
votes
1 answer

Why psql can't find relation name for existing table?

Here' my current state. Eonil=# \d+ List of relations Schema | Name | Type | Owner | Size | Description --------+------------+-------+-------+------------+------------- public | TestTable1 | table | Eonil |…
eonil
  • 83,476
  • 81
  • 317
  • 516
60
votes
7 answers

Rename SQL Server Schema

How can I rename a schema using SQL Server?
Dawid