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]
2931 questions
13
votes
3 answers
How to connect to multiple PostgreSQL schemas from Django?
In my GeoDjango project I want to connect to a legacy PostgreSQL/PostGIS database. It contains the following schemas:
data // contains all the geospatial data
django // empty, created by me
public // system tables such as spatial_ref_sys
I want…

JJD
- 50,076
- 60
- 203
- 339
13
votes
3 answers
Add default value to enum type field in schema builder
I'm using the following method to create a database column of type ENUM in schema builder:
$table->enum('status', array('new', 'active', 'disabled'));
I'd like to set it's default value to active.
I tried to do this:
$table->enum('status',…

Peter
- 233
- 2
- 4
- 8
13
votes
2 answers
Database Structure involving dynamic fields
Im working on a project. Its mostly for learning purposes, i find actually trying a complicated project is the best way to learn a language after grasping the basics. Database design is not a strong point, i started reading up on it but its early…

user1547410
- 863
- 7
- 27
- 58
13
votes
2 answers
How to manually set seed value as 1000 in MySQL
I am using MySQL 5. I need to set the seed value as 1000 for my auto increment field.
How can I set it?
user186164
12
votes
2 answers
Mysql Datatype - Enum or not to Enum, Can Enum be blank?
I have large DB (many millions of rows) and I'm trying to make the best choices for datatypes for 2 fields. Most everything I have made varchar or INT. However, 2 fields I'm wondering if Enum is the best way.
Field 1
First field is gender, My data…

Kevin
- 1,685
- 7
- 28
- 55
12
votes
4 answers
Updating database schema with Entity Framework Code First
Entity Framework Code First is a great framework for developing new projects. But what about extending an existing database?
For instance what if I simply want to add an additional property to an existing data entity? Is there any "code first" way…

Adrian Grigore
- 33,034
- 36
- 130
- 210
12
votes
1 answer
Using SqlBulkCopy, how do I insert data into a table in a non-default database schema?
I need to insert data into a table in a schema named Staging using SqlBulkCopy.
It appears the API only allows you to set the target table name by using the DestinationTableName property.
How do I accomplish this? Is it possible?

Jon Seigel
- 12,251
- 8
- 58
- 92
12
votes
4 answers
2PL, Rigorous vs Strict Model, Is there any benefit?
In 2PL (two phase locking), what advantage(s) does the rigorous model have over the strict model?
I) There is no advantage over the strict model.
II) In contrast to the strict model, it guarantees that starvation cannot occur.
III) In contrast to…
user4733521
12
votes
4 answers
Followers - mongodb database design
So I'm using mongodb and I'm unsure if I've got the correct / best database collection design for what I'm trying to do.
There can be many items, and a user can create new groups with these items in. Any user may follow any group!
I have not just…

Ross
- 1,425
- 1
- 19
- 38
12
votes
1 answer
SQLCMD variables and SSDT schema compare issue
I want the comparison below to not show a difference. According to MSDN
(see step 7), there should be a SQLCMD Variables function available which I cannot find. This documentation is for SQL 2010, but I am using 2012. There doesn't appear to be 2012…

Keith Walton
- 5,211
- 6
- 39
- 53
11
votes
2 answers
Simplified/shorthand SQL Data Definition Languages?
Some people like describing their database structure in a simple textual way instead of using CREATE TABLE statements. A few example:
Foreign key as Primary key
Multiple Primary Keys as single foreign key
How can I set up a database schema where…

biziclop
- 14,466
- 3
- 49
- 65
11
votes
5 answers
How to model a database with many m:n relations on a table
I am currently setting up a database which has a large number of many-to-many relations. Every relationship was modeled via a link table. Example:
A person has a number of jobs, jobs are fulfilled by a number of persons. A person has a number of…

Martijn Burger
- 7,315
- 8
- 54
- 94
11
votes
4 answers
Hierarchical Data - Nested Set Model: MySql
I am just learning how to implement the Nested Set Model but still have confusion with a certain aspect of it involving items that may be part of multiple categories. Given the example below that was pulled from HERE and mirrors many other examples…

swisscheese
- 1,765
- 4
- 23
- 25
11
votes
2 answers
Data Modeling: Logical Modeling Exercise
In trying to learn the art of data storage I have been trying to take in as much solid information as possible. PerformanceDBA posted some really helpful tutorials/examples in the following posts among others: is my data normalized? and Relational…

swisscheese
- 1,765
- 4
- 23
- 25
11
votes
3 answers
Weird Rails migration / schema.rb issue
A while back I ran the following migration:
class CreatePipelineSpecs < ActiveRecord::Migration
def change
create_table :pipeline_specs do |t|
t.integer :id_no
t.string :od
t.string :wt
t.string :material
t.string…

Dan Tappin
- 2,692
- 3
- 37
- 77