Questions tagged [database-schema]

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.

2784 questions
880
votes
14 answers

How to rollback a specific migration?

I have the following migration file db\migrate\20100905201547_create_blocks.rb How can I specifically rollback that migration file?
AnApprentice
  • 97,752
  • 174
  • 583
  • 971
528
votes
12 answers

How to see indexes for a database or table in MySQL?

How do I see if my database has any indexes on it? How about for a specific table?
Blankman
  • 236,778
  • 296
  • 715
  • 1,125
409
votes
5 answers

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?
dlamblin
  • 40,676
  • 19
  • 92
  • 127
323
votes
5 answers

What are OLTP and OLAP. What is the difference between them?

Actually what do they mean? All articles I find about them don't give me an idea, or my knowledge is too insufficient to understand it. Will some one give me some resources with which I can learn this from scratch.
Amarnath R Shenoy
  • 4,583
  • 6
  • 21
  • 32
323
votes
8 answers

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 essentially the same thing in MySQL, which leads me to…
Lloyd Banks
  • 32,108
  • 50
  • 143
  • 228
216
votes
10 answers

How to get all columns' names for all the tables in MySQL?

Is there a fast way of getting all column names from all tables in MySQL, without having to list all the tables?
dieter
  • 2,211
  • 2
  • 15
  • 6
192
votes
10 answers

How can I initialize a MySQL database with schema in a Docker container?

I am trying to create a container with a MySQL database and add a schema to these database. My current Dockerfile is: FROM mysql MAINTAINER (me) # Copy the database schema to the /data directory COPY files/epcis_schema.sql…
Marcus Gomes
  • 2,124
  • 2
  • 11
  • 14
184
votes
5 answers

Difference between database and schema

What's the difference between a Database and a Schema in SQL Server? Both are the containers of tables and data. If a Schema is deleted, then are all the tables contained in that schema also deleted automatically or are they deleted when the…
sqlchild
  • 7,928
  • 27
  • 98
  • 157
167
votes
9 answers

Is it possible to specify the schema when connecting to postgres with JDBC?

Is it possible? Can i specify it on the connection URL? How to do that?
marcosbeirigo
  • 10,238
  • 6
  • 37
  • 56
155
votes
4 answers

How to design a product table for many kinds of product where each product has many parameters

I do not have much experience in table design. My goal is to create one or more product tables that meet the requirements below: Support many kinds of products (TV, Phone, PC, ...). Each kind of product has a different set of parameters,…
StoneHeart
  • 14,122
  • 31
  • 65
  • 83
152
votes
3 answers

schema builder laravel migrations unique on two columns

How can I set a unique constraints on two columns? class MyModel extends Migration { public function up() { Schema::create('storage_trackers', function(Blueprint $table) { $table->increments('id'); $table->string('mytext'); …
user391986
  • 24,692
  • 37
  • 113
  • 191
150
votes
10 answers

How to fix Error: "Could not find schema information for the attribute/element" by creating schema

I have a windows forms application written in VS2010 with C# and get the following errors in the app.config file: Message 4 Could not find schema information for the attribute 'name' Message 8 Could not find schema information for the attribute…
Brian McCarthy
  • 4,328
  • 15
  • 46
  • 64
147
votes
7 answers

How to store arrays in MySQL?

I have two tables in MySQL. Table Person has the following columns: id | name | fruits The fruits column may hold null or an array of strings like ('apple', 'orange', 'banana'), or ('strawberry'), etc. The second table is Table Fruit and has the…
tonga
  • 10,669
  • 23
  • 69
  • 93
132
votes
2 answers

When to use MyISAM and InnoDB?

MyISAM is designed with the idea that your database is queried far more than its updated and as a result it performs very fast read operations. If your read to write(insert|update) ratio is less than 15% its better to use MyISAM. InnoDB uses row…
ajay
  • 1,490
  • 2
  • 12
  • 16
120
votes
3 answers

PostgreSQL: Can you create an index in the CREATE TABLE definition?

I want to add indexes to some of the columns in a table on creation. Is there are way to add them to the CREATE TABLE definition or do I have to add them afterward with another query? CREATE INDEX reply_user_id ON reply USING btree (user_id);
Xeoncross
  • 50,836
  • 73
  • 238
  • 351
1
2 3
99 100