Questions tagged [schema]
Schema means shape, or more generally, plan. It may be XML schema or Database schema.
schema
7,603
questions
1053
votes
20
answers
758k
views
How can I rollback a specific migration?
I have the migration file db\migrate\20100905201547_create_blocks.rb.
How can I specifically rollback that migration file?
670
votes
3
answers
367k
views
Differences between INDEX, PRIMARY, UNIQUE, FULLTEXT in MySQL?
What are the differences between PRIMARY, UNIQUE, INDEX and FULLTEXT when creating MySQL tables?
How would I use them?
467
votes
31
answers
1.2m
views
SQL statement to get column type
Is there a SQL statement that can return the type of a column in a table?
467
votes
5
answers
652k
views
How do I show the schema of a table in a MySQL database?
From the MySQL console, what command displays the schema of any given table?
387
votes
10
answers
277k
views
Difference Between Schema / Database in MySQL
Is there a difference between a schema and a database in MySQL? In SQL Server, a database is a higher level container in relation to a schema.
I read that Create Schema and Create Database do ...
360
votes
16
answers
295k
views
Difference between a user and a schema in Oracle?
What is the difference between a user and a schema in Oracle?
311
votes
2
answers
209k
views
How do I move a table into a schema in T-SQL
I want to move a table into a specific Schema using T-SQL? I am using SQL Server 2008.
308
votes
5
answers
114k
views
Version of SQLite used in Android
What version of SQLite is used in Android?
I'm wondering how to handle schema migrations. The newer SQLite versions support an ALTER TABLE SQL command which save me from having to copy data, drop the ...
274
votes
14
answers
303k
views
XML Schema (XSD) validation tool? [closed]
At the office we are currently writing an application that will generate XML files against a schema that we were given. We have the schema in an .XSD file.
Are there tool or libraries that we can ...
255
votes
12
answers
441k
views
Change Schema Name Of Table In SQL
I want to change schema name of table Employees in Database. In the current table Employees database schema name is dbo I want to change it to exe. How can I do it ?
Example:
FROM
dbo.Employees
...
250
votes
11
answers
21k
views
First-time database design: am I overengineering? [closed]
Background
I'm a first year CS student and I work part time for my dad's small business. I don't have any experience in real world application development. I have written scripts in Python, some ...
241
votes
4
answers
291k
views
What does GRANT USAGE ON SCHEMA do exactly?
I'm trying to create a Postgres database for the first time.
I assigned basic read-only permissions to the DB role that must access the database from my PHP scripts, and I have a curiosity: If I ...
235
votes
18
answers
324k
views
What is the difference between a schema and a table and a database?
This is probably a n00blike (or worse) question. But I've always viewed a schema as a table definition in a database. This is wrong or not entirely correct. I don't remember much from my database ...
205
votes
11
answers
227k
views
What is difference between XML Schema and DTD?
I have googled this question, but I do not understand clearly what is an XML schema and DTD (document type definition), and why the XML schema is more powerful compared to DTD.
Any guidance would be ...
201
votes
12
answers
129k
views
What good are SQL Server schemas?
I'm no beginner to using SQL databases, and in particular SQL Server. However, I've been primarily a SQL 2000 guy and I've always been confused by schemas in 2005+. Yes, I know the basic definition ...
185
votes
11
answers
386k
views
PostgreSQL: Export the schema of a database
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 ...
178
votes
6
answers
436k
views
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, ...
154
votes
10
answers
206k
views
Any tools to generate an XSD schema from an XML instance document? [closed]
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 ...
153
votes
20
answers
138k
views
Good tool to visualise database schema? [closed]
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 ...
140
votes
2
answers
131k
views
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.<what_ever_object_name_under_schema>.
Well, the catalog "wrapper" is now quite confusing. Why ...
138
votes
16
answers
103k
views
How do you version your database schema? [closed]
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 ...
132
votes
7
answers
122k
views
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 ...
127
votes
15
answers
174k
views
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 {
...
124
votes
11
answers
239k
views
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 ...
120
votes
11
answers
240k
views
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.
118
votes
9
answers
200k
views
Which SchemaType in Mongoose is best for a timestamp?
I'm using Mongoose, MongoDB, and Node.js.
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 ...
112
votes
7
answers
122k
views
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()...
110
votes
3
answers
34k
views
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 ...
104
votes
6
answers
63k
views
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 ...
96
votes
3
answers
136k
views
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 ...
94
votes
5
answers
300k
views
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 ...
94
votes
9
answers
135k
views
How can I tell jaxb / Maven to generate multiple schema packages?
Example:
</plugin>
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
&...
83
votes
6
answers
84k
views
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.
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://example....
81
votes
8
answers
211k
views
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 ...
79
votes
10
answers
23k
views
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 ...
73
votes
4
answers
143k
views
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 ...
71
votes
2
answers
69k
views
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 ...
71
votes
1
answer
57k
views
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?
70
votes
10
answers
41k
views
XML Attributes vs Elements [duplicate]
When should you use XML attributes and when should you use XML elements?
e.g.
<customData>
<records>
<record name="foo" description="bar" />
</records>
</...
67
votes
8
answers
121k
views
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 ...
65
votes
6
answers
48k
views
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 ...
65
votes
6
answers
33k
views
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?
64
votes
13
answers
46k
views
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:
...
63
votes
1
answer
30k
views
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
--------+------------+-------+-------+------------+-------...
63
votes
2
answers
94k
views
What does the ref attribute on an element in an XSD do?
Documentation seems to say that it references another element in the schema, but how could it be used - I've never seen it in schemas that I have worked with.
Anyone got any nice use cases or ...
61
votes
8
answers
67k
views
Rename SQL Server Schema
How can I rename a schema using SQL Server?
60
votes
1
answer
22k
views
PostgreSQL's schemas for multi-tenant applications
I'm learning about multi-tenant applications and how PostgreSQL's schemas can be used for this.
Researching the subject, I ended up finding an article in which the author describes a poor experience ...
60
votes
2
answers
115k
views
Json Schema example for oneOf objects
I am trying to figure out how oneOf works by building a schema which validates two different object types. For example a person (firstname, lastname, sport) and vehicles (type, cost).
Here are some ...
60
votes
5
answers
110k
views
Possible to set default schema from connection string?
With SQL Server 2005 and 2008 is it possible to set the default schema from the connection string? It'd be a lot easier if we didn't have to manually set the schema with SQL code.
59
votes
4
answers
47k
views
Query to show all tables and their collation
Is there a query that can be run in mysql that shows all tables and their default collation? Even better if there was on that could show all collations on all columns of all tables.