Questions tagged [table]
A data structure that organizes information into rows and columns.
496
questions
-2
votes
0
answers
10
views
I am trying to add advertising script code but the form field only accepts TEXT only
I am trying to add advertising script code but the fversion mysqlnd 7.4.29
phpMyAdmin to edit the databaseorm field only accepts TEXT only
version mysqlnd 7.4.29
phpMyAdmin to edit the database
1
vote
1
answer
24
views
Adding a column to a table then updating the table
I have a code that looks something like this
declare @query = '
Alter Table Temp
Add NewColumn int
update Temp
set NewColumn = 100'
exec (@query)
It will give error NewColumn does not ...
-4
votes
0
answers
22
views
Hi, I am new to Dbeaver and I cannot create a table. Below you will find my code so you can have a better understanding & I hope you can help me
CREATE TABLE nasdaq(
nasdaq trade varchar(50),
symbol varchar(50),
security name varchar(256),
listing exchange varchar(50),
market category varchar(50),
etf varchar(50),
round lot size varchar(50),
...
0
votes
0
answers
30
views
Large MySQL table has become unresponsive due to size, what can be done to rescue it?
I am currently building a custom project which collects large amounts of data, and I am now in a process of processing that data. One particular table, which holds all of the data that's been ...
19
votes
6
answers
2k
views
Is there a generic term for tables and views?
I am looking for a generic term, e.g. for a database abstraction, that includes all tabular data structures like database tables, views, tabular query results aso.
As far as I understand, 'entity' is ...
0
votes
1
answer
50
views
Table design to store Refund Transaction information
I have a transaction table that contains purchases and refunds. I'd like to create a linkage between purchase and refunds in the same table (I decided not to use a separate table). I'm not sure which ...
1
vote
1
answer
41
views
DB strategies to store data in CSV files?
I'm new to the Postgres community and would love to hear your recommendations.
To give a bit more context, each file is associated with a unique zip code and address and contains 8,760 (365 days x 24 ...
0
votes
1
answer
37
views
Oracle - Big Table Archiving
Version: Oracle 12cR2 EE
The table contains the following column types: NUMBER, CLOB, NVARCHAR2, TIMESTAMP, VARCHAR2
Table size: 95GB
Table row count: 20M
Table partitioned? No
Indexes on table: there ...
-1
votes
1
answer
16
views
Table normalization of given table
I've got a table and I'm supposed to figure out why it breaks with 1NF, 2NF and/or 3NF.
I know the differences between these three, but I'm bad at telling what attributes are primary keys and what is ...
2
votes
1
answer
57
views
How would you design a table to store Configuration or a Setup in the following Questionnaire scenario?
I have a table named Questionnaire which will contain binary YES/NO type of questions with following columns.
Id INT
Question VARCHAR
GroupId INT
1
Are you a female?
1
2
Are you healthy?
1
3
Are ...
0
votes
1
answer
44
views
Help with Database Design for a CRM
I am creating a CRM for a call-center and I want to store the input field data in a database.
My problem is that I am quite new to this ordeal and have little - to no idea how to structure my database....
0
votes
0
answers
20
views
How to specify default CREATE TABLE values just once?
Is there any way I can just say once that the default type should be TEXT, and the
default value should be '' for all CREATE TABLEs?
Currently I must do:
CREATE TABLE "t" (dbm TEXT DEFAULT ''...
0
votes
0
answers
529
views
Linked server error- The table either does not exist or the current user does not have permissions on that table
There is a view that is being called from Server A (SQL 2016) and this view needs to read data from Server B (SQL 2014). There is a linked server set up between these two servers and the connection ...
0
votes
1
answer
53
views
Best practice for SQL table names when using sub namespaces that exceed maximum table name length
I have a MySQL database that includes many tables named according to a namespace that uses sub names and underscores (_ as in a_b_c), such as the following:
life_domain_kingdom_phylum
...
0
votes
1
answer
153
views
Strong vs weak entity types on SQL
I have a 3NF normalized database design and was trying to understand the concept of strong vs weak entity types and my understanding is weak entity types are tables that don't have a primary key. ...
-2
votes
1
answer
126
views
Count rows from multiple tables with similar names
I want to have 2 columns: Table Name and Row Count
When I run this, I get 12 table names in my database. How do I then count the rows in each one without having to union 12 count queries together:
...
0
votes
1
answer
51
views
Is pg_database a catalog or a table?
I am learning about PostgreSQL and am trying to understand basic concepts like schemas, catalogs and tables. I have been reading PostgreSQL: Up and Running, and to quote the book:
Schemas are ... the ...
1
vote
0
answers
41
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"...
0
votes
1
answer
832
views
Export Postgres data without superuser privileges
I'm using Postgres 14 on CentOS 7. I would like to export a single table's worth of data but I don't have superuser privileges. Unsurprisingly, I get this error
myapp=> COPY myapp_currencyprice ...
0
votes
0
answers
27
views
Best approach to convert a non trivial function (CASE WHEN) into a lookup (decision) table?
Assume A, B, C etc are attribute values in the current rowset
Current function logic is similar to:
Case A = 'Y' then
Case B in (1,2,3,4,5) OR C in (3,4,5,6) then 'Sales'
Case B in (99,98,102) OR D ...
2
votes
2
answers
482
views
Should I split semantically almost identical entities into different tables?
Suppose you have 2 different entities:
Entity 1: PersonalNote - a note you create for yourself
Entity 2: SharedNote - a note you share with someone else
A PersonalNote can also be viewed as a ...
-1
votes
1
answer
31
views
Command basics, look through three tables [closed]
Hi, I'm starting to learn mysql and am confronted with the commands. I think I understand the basics, but with this example I'm failing to set up the commands correctly.
The underlined keys are ...
-1
votes
1
answer
36
views
Percentage in table group [closed]
I use PostgresSQL. Given table t1, I would like to obtain result. How to? The numbers on table result are the numbers on column value1 divided by their sum. I utilize PostgresSQL server. I thank you.
...
0
votes
1
answer
116
views
One lookup table per type or one lookup table to handle multiple types
We are creating a lookup table that will handle multiple types of data. For simplicity, I'm only including 2, but there are actually 6. The table will store static data for each type.
We decided to ...
0
votes
0
answers
32
views
How to get all the extended properties inheritance and regarding this heritage apply the values of extended properties?
Hope you are well
I'm been a bit stuck trying to develop the code to get the inheritance of extended properties.
I will explain the situation:
The thing is have a query to list all extended properties ...
0
votes
1
answer
56
views
Get number of deleted pages in PostgreSQL table/index?
How can I get the number of deleted pages in a table or index?
My purpose in asking is to modify an index bloat query that otherwise doesn't take into account which pages are deleted (and therefore ...
0
votes
1
answer
71
views
How bad is to prefix table names to order them exactly as I want?
When using an interface like phpmyadmin/heidisql or others, I have this tables:
account
account_post
account_post_status
account_post_type
account_status
account_type
Ideal for me is this:
account
...
1
vote
0
answers
29
views
How to design a table schema to optimize insert and updates for a unique numeric column
Suppose there is a table with 3 columns
id, name, score
Name and score are both unique columns.
The use case is that,
The table is pre-populated with 10 rows. Scores are set from 1-9.
A user can ...
0
votes
0
answers
60
views
SQL Server table design handling ubiquitous information
I have a doubt about table desgin in SQL Server 2019.
Usually i try to map tables with each entity in my "conceptual model", so as usual i do that and create tables for user, articles, ...
2
votes
3
answers
269
views
Count number of occurences per location per hour in PostgreSQL
I have a dataset in Postgres of boat locations on waterways. Here is a sample of the table:
boat_id
ts
waterway_id
Boat_A
2019-01-01 16:29:11
WW_01
Boat_A
2019-01-01 17:03:04
WW_02
Boat_B
2019-01-...
0
votes
2
answers
330
views
SQL Server - how to define default value function that require column name?
Column names are not permitted when declaring default column value. Is there a workaround to achieve something like this?
CREATE TABLE [dbo].[Tasks]
(
[TaskId] INT IDENTITY(1,1) NOT NULL,
[...
0
votes
1
answer
655
views
Changing InnoDB table format to dynamic
I run a forum, and this new warning pops up in the admin area:
You have one or more InnoDB tables that are using the Compact row
format. This may limit the amount of data that can be stored within
...
-2
votes
1
answer
19
views
Difference between these two query implementations of inner joining a table with a lookup table?
I've been learning querying and I've come across the concept of inner joining
Where this query inner joins the columns departmentId from employee and department tables and displays the value of ...
0
votes
1
answer
73
views
Return unique records based on shared column in 3 tables
This is the database schema that I'm working with and I've included some sample data as an example of what is currently in the database.
CREATE TABLE Visits ([ADATE] date, [AKEYTIME] varchar(10), [...
0
votes
1
answer
43
views
handling primary key with large tree, best way to get root id from child table X
I always used database design using this pattern;
root table with PK id1
child1 table with PK id2 FK id1
child2 table with PK id3 FK id2
child3 table with PK id4 FK id3
etc...
so if I have to get ...
0
votes
2
answers
162
views
How to improve performance to 12million rows table?
I have performance issues on a query in a big table (12 million records) based on Geonames, that's a read-only database so NO DELETE, UPDATE or INSERT only SELECT.
There are queries I make every now ...
1
vote
0
answers
22
views
In Interactive SQL 12.0.1, How do I declare a temporary table and then run a compound statement in a single SQL Statement?
I am trying to load a csv file into a temporary table and then run a compound SQL Statement on that table. I can get the DECLARE LOCAL TEMPORARY TABLE ... INPUT INTO ... FROM [filename] to work on its ...
0
votes
2
answers
21
views
Count results of table by date [closed]
I am trying to query the number of transactions that occur on a given day with the following query
select COUNT(seq_no) from "table"
where start_time >= '2020-04-01 00:00:00'
and ...
0
votes
1
answer
39
views
MS SQL Creating Tables and Adding Values by a Trigger
Table_A is an existing table which has 3 columns Id (PK), Name, Stock.
I would like to create a trigger to create a table.
For example, Table_A has an item, Id (PK) = 3, Name = Apple, Stock = 10.
By ...
0
votes
1
answer
27
views
is it safe to create mysql database by just creating its directory?
context: I want a separate encrypted filesystem per database (to have a separate key) on MySQL 5.7 but if I mount it before I execute CREATE DATABASE foo it fails with error database exists, and ...
0
votes
0
answers
44
views
Can a database have an unnamed row?
I came across a question asking whether it is possible to have unnamed rows and columns in a database. I assumed unnamed implied primary key. I'm not sure whether my assumption is correct. When I ...
1
vote
1
answer
54
views
Add constraint to table creation in SQL
I have to create a table Product with elements P, PType, PName, Price and Origin.
I need to have the constraint that all products with PType "Meat" must have "Europe" as Origin. I ...
0
votes
1
answer
34
views
Consolidate / sort / combine / merge data for dummies
I am looking for a non-scripting solution to combine data from 3 different tables (preferably using spreadsheet software like Microsoft Excel but a database would also work e.g. Microsoft Access). I ...
0
votes
1
answer
37
views
In SQLITE, how do you create a new table into its own file?
I am trying to do key value pairing, where performance is the top priority. I understand that the smaller a sqlite file is, the better the read and write speeds are, and so I am going to create about ...
0
votes
1
answer
246
views
Oracle 11g - Decreasing Big Table Size
I want to reduce the size of a table.
I thought if I could do this with export / import, but when I check it
with the ESTIMATE_ONLY option, it doesn't seem to work.
I have no chance of using ...
0
votes
1
answer
57
views
Capture row with highest value from each percentile
So far I've tried doing this:
SELECT MAX(buckets.position_id), NTILE
FROM (
SELECT position.position_id,NTILE(100) OVER (ORDER BY position.position_id)
FROM position
WHERE activity_id = 8
...
2
votes
1
answer
407
views
MySQL table with identical name multiple times in same database
I stumbled into a pretty nasty bug into our PROD environment
I was running some alter scripts and it appears it ended up duplicating the table for each column altered.
I've tested with MySQL Workbench,...
0
votes
1
answer
300
views
Repair Database using .FRM .IBD .OPT Files ( Hard copy mysql folder )
I had a crash on my server.
The only thing I could do was hard copy the mysql folder
Now I am trying to access my database again through the PHPMyAdmin interface.
Some databases (mostly WordPress) run ...
0
votes
1
answer
83
views
Postgresql: Disallow duplicate value to be inserted if already in any of multiple columns?
Suppose I have 3 columns:
Critical, Medium, Low
And I have data UUIDs to be inserted from another tables. And I want to disallow insertion of same UUID in any of the column if it is already present ...
0
votes
1
answer
76
views
Create cache table [closed]
I need help with SQL Server. There is a task scheduled to run an .exe file. After the exe finish execution, I can get the logs below:
2021-03-05 22:45:00 : Create cache table
2021-03-05 22:45:00 : ...