Skip to main content

Questions tagged [table]

A data structure that organizes information into rows and columns.

Filter by
Sorted by
Tagged with
40 votes
6 answers
78k views

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 ...
Mokus's user avatar
  • 1,017
103 votes
18 answers
43k views

Is adding the ‘tbl’ prefix to table names really a problem?

I’m watching some Brent Ozar videos (like this one, for instance) and he suggests not prefixing tables with ‘tbl’ or ‘TBL’. On the internet I found some blogs saying it adds nothing to documentation,...
Racer SQL's user avatar
  • 7,386
26 votes
6 answers
3k views

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 * ...
Erik Bergstedt's user avatar
19 votes
2 answers
7k views

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 ...
Basil Bourque's user avatar
10 votes
3 answers
19k views

Delete rows older than x days without locking table

we have a quite big MS SQL database with millions of rows. I created a simple script to delete rows older than 1 month, but this seems to lock the table and creates trouble for the application. The ...
user2992455's user avatar
8 votes
1 answer
20k views

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's user avatar
  • 265
3 votes
1 answer
11k views

How to generate create table script without primary and foreign key in Oracle

I have lots of schemas and tables. I want to generate create script of all of my tables. I am using below statement and it is working pretty well. SELECT DBMS_METADATA.GET_DDL('TABLE','table_name','...
Omer's user avatar
  • 433
3 votes
1 answer
451 views

How many blocks is my database

How can I write a query using Oracle SQL Developer to find how many blocks my database is using? (tables & indexes)
Phil_Charly's user avatar
2 votes
2 answers
108 views

How to write sql statement for following scenario?

So I currently have an sql statement: Select room_no, category from help_desk where room_no = '133' OR room_no = '120'; and it returns: How would I write an sql statement that would return it ...
apex's user avatar
  • 75
41 votes
1 answer
38k views

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 ...
v14t's user avatar
  • 513
8 votes
5 answers
19k views

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 ...
pjbollinger's user avatar
7 votes
3 answers
8k views

SQL - Many-to-Many relationship with same table and with relationship constraint

I have a SellerProduct table. Each row within the table represents product information as offered by a seller. The SellerProduct table has the following columns: id (serial, pk) productName (nvarchar(...
user4321's user avatar
  • 215
6 votes
1 answer
446 views

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 ...
Kolja's user avatar
  • 363
4 votes
2 answers
1k views

Managing and Removing data from huge table

I have the following scenario: A huge table, that is also the most use table by far in the system. By huge I mean it is huge in number of rows and also huge in actual disk size, because it has 2 byte ...
Luiz Eduardo Simões's user avatar
3 votes
1 answer
1k views

Ternary Relationship or (n-ary)

I'm trying to find the difference in terms of modeling a ternary relationship v/s a binary relationship in the following case. Any piece of advise would help me a lot. Company has editors who are ...
Cristian Eduardo Lehuede Lyon's user avatar
2 votes
1 answer
877 views

Conversion of simple ERD to Table: is the solution below any good?

Consider the following ERD: Suppose that all entities only have two attributes: a PK plus a name/number. I want to convert that ERD to tables. Is it needed 4 tables (1 for each relationship plus ...
feelthhis's user avatar
  • 265
1 vote
1 answer
6k views

Error code 1054: Unknown column when inserting data into a table [closed]

I have been trying to join data from two separate tables with distinct columns into a third table, but Error code 1054: Unknown Column 'Company' in field list keeps popping up. My current code ...
Anthony Potts's user avatar
1 vote
0 answers
416 views

How to log changed table fields in SQLite?

I have a table that looks like this CREATE TABLE IF NOT EXISTS "ebooks" ( "id" INTEGER PRIMARY KEY, "name" TEXT NOT NULL, "author"...
Attitude12136's user avatar
1 vote
2 answers
1k views

novice-design: Are FOREIGN KEYs always necessary? Joins on columns which are not PK

I've been wondering if following approach is bad or really very bad:). Question#1: can we use indicator_id to combine data from indicator_values and indicator_details tables (without using FOREIGN ...
LAdas's user avatar
  • 25
1 vote
1 answer
321 views

Error Code: 1248 Alias needed in MySQL

I have recently started learning MySQL and am trying to join data from two tables into a third table built. The two tables are: 'Company Financials' - Column of 'Revenue' 'Fortune500' - ...
Anthony Potts's user avatar
1 vote
2 answers
6k views

Building A SQL table horizontally VS vertically

What is a better design principle when designing SQL Server tables. One can either add columns (ie grow horizontally) or grow it vertically (ie rather adding rows) I have a situation when there are ...
Zapnologica's user avatar
1 vote
1 answer
3k views

When tables are locked does MySQL queue queries?

I have a small production website, but it's live 24/7. When running the Optimize, Analyze or Repair commands, MySQL locks the table it is working on. QUESTIONS How would this effect users trying to ...
Usman Awesòme Aslam's user avatar
1 vote
2 answers
2k views

Many tables v/s one table with different entities types

My requirement is as follows: App with internationalization and mobile v/s desktop app text support. So, I have came up with below columns in the table which I will certainly need: "CODE" ...
hagrawal7777's user avatar
1 vote
1 answer
3k views

How much the decision to use ternary or binary relationship influences the accuracy of the model with regards to a given business model?

The question title is very long, so here's a little bit of context to (try to) make it clear. I asked a question regarding ternary relationship. The question was Ternary relationship: what's the ...
feelthhis's user avatar
  • 265
1 vote
2 answers
3k views

MySQL query INSERT INTO ... failed - The Table "x" is full

I apologize if my question is incomplete or noobish, I have extremely limited knowledge of SQL but the boss wants me to figure this one out. Environment: Webmin/Virtualmin | MySQL version 5.1.73 on ...
rainfly's user avatar
  • 11
1 vote
1 answer
318 views

MySQL data precision confusion

I have two tables with same column. First table: DESC orders; Field Type Null Key Default Extra order_id int(8) unsigned zerofill NO PRI (null)...
Darwin Cabiling's user avatar
0 votes
1 answer
3k views

My database keeps crashing on startup how can i repair it without it running?

I've got some problems with my database. I hope somebody can help me out. Problem: The database keeps crashing on startup. In my log i see a couple off these errors: [ERROR] /usr/libexec/mysqld: Table ...
user3166736's user avatar
0 votes
1 answer
52 views

Return unique records based on shared column in 2 tables

I'm very new to SQL and currently using SQL Server 2008 R2. I'm fairly certain that I need to use a join but not sure if that's possible. The goal is to return just the customer's email address based ...
Cragmuer's user avatar
0 votes
1 answer
29k views

ORA-00942: table or view does not exist- Can it be solved by granting privileges to user?

I am creating a Java application that connects to an Oracle Database. In the application I connect to the DB as User A, which works as intended. I then try to access tables in Schema 1 and Schema 2....
java123999's user avatar
0 votes
2 answers
861 views

Table JOIN and CREATE new table extremely slow

I'm using something like this to create a new table: CREATE TABLE result AS (SELECT calls.*, targ_with_planned_calls.* FROM calls INNER JOIN planned ON calls.first_id = ...
jonmrich's user avatar
  • 101
0 votes
2 answers
2k views

Multiple rows v/s multiple columns

My requirement is as follows: An app with internationalization support and starting with EN and FR versions of text. So, I have 2 approaches for data in the table: 1. One column for each language: ...
hagrawal7777's user avatar
0 votes
0 answers
916 views

MYISAM can't create table: Row size too large

We are having database in MySQL 5.1, we have taken the DB backup from MySQL 5.1 and trying to restore in MySQL 5.6. We are getting below error: ERROR 1118 (42000) at line 603: Row size too large. ...
Phanindra's user avatar
  • 1,007
0 votes
2 answers
637 views

Composite Key with a column that auto increments and reset when foreign key value changes

I am trying to implement a ticket system, the numbers generated would be sequential. 4000, 4001, 4002, 4003 My idea was to have a table that relates to current raffle, and the ticket_no column is an ...
Cram Sdlido's user avatar