Questions tagged [table]

A data structure that organizes information into rows and columns.

Tables are used to organize data into a structured format defined by a fixed number of columns, and an unlimited number of rows. This allows a specific value to be retrieved for an individual column/row cell. In addition to storing data, a table can have associated metadata which may constrain/restrict the data it contains.

To CREATE a table, use the CREATE TABLE command,

To ALTER a table, use the ALTER TABLE command,

To delete or DROP a table, use the DROP TABLE command,

See: Table (database)

491 questions
39
votes
1 answer

Changing mysql table comment

I know that mysql table comment can be defined at the creation with: create table (...)comment='table_comment'; And you can display comments by: show table status where name='table_name'; How do you change (alter?) table comment after it's been…
v14t
  • 493
  • 1
  • 4
  • 6
39
votes
6 answers

Error Code 1117 Too many columns; MySQL column-limit on table

I have a table with 1699 columns and when I'm trying to insert more columns I get, Error Code: 1117. Too many columns In this table I have only 1000 rows. For me the most important thing is the number of columns. Are there any limitations on the…
OHLÁLÁ
  • 987
  • 4
  • 14
  • 17
35
votes
7 answers

How to determine the size of my tables in the SQL Server database

Is there any built-in function/stored procedure/query which is helpful to retrieve information about the size of MyTable in the SQL Server database?
Heisenberg
  • 1,447
  • 5
  • 18
  • 30
26
votes
6 answers

Index performance on ON versus WHERE

I have two tables @T1 TABLE ( Id INT, Date DATETIME ) @T2 TABLE ( Id INT, Date DATETIME ) These tables have a non-clustered index on (Id, Date) And I join these tables SELECT * FROM T1 AS t1 INNER JOIN T2 AS t2 ON t1.Id =…
Erik Bergstedt
  • 387
  • 3
  • 9
19
votes
4 answers

How to handle table design with variable columns

I have a table design scenario and as a non-DBA type, would like opinions on which is more scaleable. Say you are asked to record information on houses for a metro area, starting with a small neighborhood (200 houses) but eventually growing to…
Schmitty23
  • 191
  • 1
  • 1
  • 4
16
votes
2 answers

What is a “transition table" in Postgres?

The page describing what's new in Postgres 10 mentions “Transition Tables for Triggers”. Transition Tables for Triggers This feature makes AFTER STATEMENT triggers both useful and performant by exposing, as appropriate, the old and new rows to…
Basil Bourque
  • 8,776
  • 14
  • 46
  • 78
16
votes
2 answers

Why can't I see my table (PostgreSQL) when I use \dt(+) inside psql?

I have created the table donor in the schema reference as per: CREATE TABLE reference.donor ( donor_code smallint PRIMARY KEY, donor_name character varying NOT NULL, donor_type smallint REFERENCES reference.donor_type (type_id), …
dw8547
  • 747
  • 2
  • 8
  • 22
10
votes
2 answers

How to list all table columns in sorted order?

I know that \d table_name lists all columns for that table, but is there a way to list them sorted in alphabetical order?
oxfist
  • 321
  • 1
  • 4
  • 14
9
votes
3 answers

Two tables with same name in MySQL

I got this weird issue today when I dropped a temporary table. I dropped the temporary table and desc the table just to verify. But, the table was not dropped. After some searching I found that: MySQL allows to create a temporary table with the same…
BALA
  • 155
  • 2
  • 2
  • 7
8
votes
5 answers

How to retrieve closest value based on look-up table?

I'm attempting to create a query that will find the closest value from one table and return its ID into the resulting table. Below is an example that should describe the situation better. Sample Data These two tables will exist in the SQL…
pjbollinger
  • 81
  • 1
  • 1
  • 3
8
votes
1 answer

Ternary relationship: what's the difference between having single table and having multiple tables?

Consider the following ternary relationship: Suppose that all entities have only two attributes (PK and Name). Here are the tables I derived (5 tables): Sector ------------------------- ID_Sector …
feelthhis
  • 265
  • 1
  • 3
  • 10
7
votes
4 answers

In a one-to-one relationship, where should the foreign key be placed?

I am currently designing an ERD for a project management system. I am unable to choose between two workable solutions as the best solution as I wish to embrace the best standards. The two entities that can access the system are the clients and…
Xegara
  • 219
  • 1
  • 2
  • 9
6
votes
1 answer

How to organize database for translations, performance?

I am working on a new project for an international website. The task is to get this available in 16 languages. On the database structure, I was wondering if there is any performance advantage or disadvantage between these two approaches. What would…
koljanep
  • 353
  • 2
  • 9
  • 20
6
votes
1 answer

Column name or number of supplied values does not match table definition error

I have a table, with two foreign keys defined on two columns of that table. The problem is that, when I insert the values from SQL Server, I get the following error: Column name or number of supplied values does not match table definition Please…
codeOholic
  • 63
  • 1
  • 1
  • 3
6
votes
1 answer

At what point is a (disk-based) table removed from memory after data is read from it?

Are (disk-based, so no Hekaton) tables persisted in memory for longer than the lifespan of the query that is reading data from them? If so, what determines how long they stay in memory for? Is there a way to manage how long they persist in memory…
J.D.
  • 22,196
  • 3
  • 34
  • 78
1
2 3
32 33