A description of the structure of the database - including the structure of the tables, columns, constraints, views, etc, etc... that make up the database.Normally defined in the text, generally SQL in an RDBMS, the schema describes the complete blueprint for the database, defining everything about the database except that data itself.
Questions tagged [database-schema]
2784 questions
39
votes
4 answers
MongoDB Diagram Design Tool
Planning a project using MongoDB and looking for a tool to map out the database.
Any suggestions of a database design tool similar to http://ondras.zarovi.cz/sql/demo/ that specifically supports MongoDB?
Thanks
Hutch
- 841
- 1
- 8
- 9
38
votes
8 answers
SQL Query to search schema of all tables
I am working on a SQL Server 2008 Db that has many tables in it (around 200). Many of these tables contain a field by the name "CreatedDate". I am trying to identify all the table schema with this particular field.
Is there a SQL query to do this?
pencilslate
- 12,238
- 17
- 54
- 72
36
votes
4 answers
How to change schema of all tables, views and stored procedures in MSSQL
Recently we were having issues on our database server and after long efforts it was decided to change the database server. So we managed to restore the database on another server, change the connection string, etc. Everything was going as planned…
anar khalilov
- 15,134
- 9
- 43
- 58
36
votes
4 answers
Import and export schema in cassandra
How to import and export schema from Cassandra or Cassandra cqlsh prompt?
vpggopal
- 397
- 1
- 3
- 3
36
votes
2 answers
Cannot create a new table after "DROP SCHEMA public"
Since I wanted to drop some tables and somebody suggested the below and I did it:
postgres=# drop schema public cascade;
DROP SCHEMA
postgres=# create schema public;
CREATE SCHEMA
Then I got problem when creating a new database, such as:
postgres=#…
user1342336
- 877
- 2
- 16
- 27
35
votes
2 answers
Adding an one-out-of-two not null constraint in postgresql
If I have a table in Postgresql:
create table Education (
id integer references Profiles(id),
finished YearValue not null,
started YearValue,
qualification text,
schoolName …
Jimmy
- 361
- 1
- 3
- 3
35
votes
4 answers
MongoDB Structure for message app
I am breaking my mind up thinking about a good document structure for handling a message app.
I basically need three (or four) types of objects:
The user (username, email, password, etc.)
The contacts list (containing different contacts or contacts…
dev.pus
- 7,047
- 12
- 34
- 49
33
votes
5 answers
mongoengine - Ignore extra fields for schema validation
I am trying to query my database. Some records currently have extra fields that are not included in my model schema (by error, but I want to handle these cases). When I try to query the DB and transform the records into the schema, I get the…
Andrew
- 1,177
- 2
- 11
- 25
32
votes
11 answers
Dynamically changing schema in Entity Framework Core
UPD here is the way I solved the problem. Although it's likely to be not the best one, it worked for me.
I have an issue with working with EF Core. I want to separate data for different companies in my project's database via schema-mechanism. My…
user3272018
- 1,831
- 5
- 22
- 43
32
votes
2 answers
Rails 3. Creating a production database
How can I create a production database in Rails 3 and load a schema to it?
I tried the following approaches...
I.
rake db:create Rails.env='production' && rake db:schema:load Rails.env='production'
II.
# config/environment.rb
# Set the rails…
Shamaoke
- 5,924
- 7
- 31
- 40
31
votes
6 answers
Why use a 1-to-1 relationship in database design?
I am having a hard time trying to figure out when to use a 1-to-1 relationship in db design or if it is ever necessary.
If you can select only the columns you need in a query is there ever a point to break up a table into 1-to-1 relationships. I…
chobo
- 29,453
- 35
- 118
- 182
30
votes
2 answers
Django and postgresql schemas
I've been trying to solve this one all week, help very much appreciated.
I have various schemas in a postgres db and I would like to be able to map to them from within the same or across different django apps.
Some of the schemas are…
Spatial Digger
- 1,233
- 1
- 11
- 20
29
votes
5 answers
How to duplicate schemas in PostgreSQL
I have a database with schema public and schema_A. I need to create a new schema schema_b with the same structure than schema_a.
I found the function below, the problem is that it does not copy the foreign key constraints.
CREATE OR REPLACE…
Cristhian Boujon
- 3,552
- 10
- 41
- 81
28
votes
2 answers
Group output of SHOW COLUMNS into comma-delimited list
I am comparing database tables on a development server against a live server, looking for column name changes, new columns, and columns that have been dropped. I'd like to do something like this:
SELECT GROUP_CONCAT(Field) FROM (SHOW COLUMNS ON…
Chris Baker
- 46,402
- 12
- 93
- 112
28
votes
3 answers
Doctrine schema update or Doctrine migrations
What are the practical advantages of Doctrine Migrations over just running a schema update?
Safety?
The orm:schema-tool:update command (doctrine:schema:update in Symfony) warns
This operation should not be executed in a production…
Tamlyn
- 18,041
- 10
- 96
- 117