Questions tagged [database-table]

In a relational database management system (RDBMS) a table organizes the information in rows and columns. Each table has a defined number of columns, each of which is identified by its name, but the number of rows is variable, consisting of one for each line of data.

In a relational database management system (RDBMS) a table organizes the information in rows and columns. Each table has a defined number of columns, each of which is identified by its name, but the number of rows is variable, consisting of one for each line of data.

More Information:

  1. The wiki entry on database tables is a good source of information.
  2. Microsoft provides an intuitive definition of a table
313 questions
40
votes
9 answers

Check if extended property description already exists before adding

So, I have a script that adds extended properties, some describing a table, some describing a column. How can I check if the extended property exists before adding it so that the script does not throw an error?
ScubaSteve
  • 7,724
  • 8
  • 52
  • 65
39
votes
4 answers

Auto increment table column

Using Postgres, I'm trying to use AUTO_INCREMENT to number my primary key automatically in SQL. However, it gives me an error. CREATE TABLE Staff ( ID INTEGER NOT NULL AUTO_INCREMENT, Name VARCHAR(40) NOT NULL, PRIMARY KEY…
Jimmy
  • 817
  • 4
  • 13
  • 19
33
votes
7 answers

SQL Server: drop table cascade equivalent?

In oracle, to drop all tables and constraints you would type something like DROP TABLE myTable CASCADE CONSTRAINTS PURGE; and this would completely delete the tables and their dependencies. What's the SQL server equivalent??
Sinaesthetic
  • 11,426
  • 28
  • 107
  • 176
30
votes
3 answers

Limit an sqlite Table's Maximum Number of Rows

I am looking to implement a sort of 'activity log' table where actions a user does are stored in a sqlite table and then presented to the user so that they can see the latest activity they have done. However, naturally, I don't feel it is necessary…
Jorge Israel Peña
  • 36,800
  • 16
  • 93
  • 123
28
votes
5 answers

What is table partitioning?

In which case we should use table partitioning?
P Sharma
  • 2,638
  • 11
  • 31
  • 35
24
votes
5 answers

How to reduce size of SQL Server table that grew from a datatype change

I have a table on SQL Server 2005 that was about 4gb in size. (about 17 million records) I changed one of the fields from datatype char(30) to char(60) (there are in total 25 fields most of which are char(10) so the amount of char space adds up to…
MrVimes
  • 3,212
  • 10
  • 39
  • 57
21
votes
4 answers

How can I list all tables in a database with Squirrel SQL?

I use Squirrel SQL to connect to a JavaDB/Derby database on my desktop. I can run SQL queries. But how can I list all tables in the database? And preferably all column and column types.
Jonas
  • 121,568
  • 97
  • 310
  • 388
21
votes
2 answers

T-SQL Pivot? Possibility of creating table columns from row values

Is it actually possible to rotate a T-SQL (2005) so that (for the sake of argument) the values of the first column's rows become the titles of the output table's columns? I realise this is not really what PIVOT is for, but it's what I need - the…
Matt W
  • 11,753
  • 25
  • 118
  • 215
18
votes
1 answer

When to use multiple databases vs multiple tables

So I've been working on a project where I have lots of data. In some collections of data, there are parts of data that link to other collections of data as in relational databases. However, I am confused over whether I should use multiple databases…
Farbod Salamat-Zadeh
  • 19,687
  • 20
  • 75
  • 125
16
votes
10 answers

How can I delete the contents of all tables in my database in phpMyAdmin without dropping the database?

How can I empty the contents of all tables in my database in phpMyAdmin without dropping any of the tables in the database? Since I do this several times an hour while in development, I'd rather not individually click "Empty" on all 60+ tables every…
Joshua
  • 6,643
  • 15
  • 55
  • 76
14
votes
4 answers

Table Scan and Index Scan in SQL

What is the difference between Table scan and Index scan in SQL and where it is used specifically?
Manisha Awasthi
  • 449
  • 1
  • 5
  • 16
12
votes
3 answers

SELECT data FROM two tables in MySQL

What I have: The next structure: table_zero -> id (PRIMARY with auto increment) -> other table_1 -> id (foreign key to table zero id) -> varchar(80) Example value: (aahellobbb) -> one_field table_2 -> id (foreign key to table zero id) ->…
Mark Tower
  • 559
  • 1
  • 5
  • 15
11
votes
3 answers

database design: what fields are must for a user table in database?

I am trying to design a user table for MySQL. for now, my user table looks like this users ( BIGINT id, VARCHAR(?) username, VARCHAR(?) password, VARCHAR(254) email, DATETIME last_login, DATETIME data_created ) what other fields should I also…
Joon
  • 9,346
  • 8
  • 48
  • 75
9
votes
2 answers

Sequelize: Change "validate" meta data of column

Is it possible to change the "validate" meta data of a column using a migration file? I tried the queryInterface.changeColumn method and it seems like it can only change the three meta data mentioned in the docs (defaultValue, allowNull, and…
9
votes
4 answers

Laravel Query builder and table names

I noticed that I write the database table names quite a lot, and in different files, when I use the Query Builder. If I were to change the database table names, I would have to search and change quite many rows in my project. Is this an issue your…
Olof84
  • 919
  • 4
  • 14
  • 29
1 2
3
20 21