Questions tagged [table]

A data structure that organizes information into rows and columns.

Filter by
Sorted by
Tagged with
3 votes
2 answers
176 views

Snowflake won't allow an analytic function to be renamed

In the code below, I can do the LAG and PARTITION BY with no problem as a query. But I need it as a table. If I do CTAS, I need an alias on the column. But when I try to put an alias on it, it fails....
James Madison's user avatar
0 votes
1 answer
23 views

Can a postgres autovacuum increase the TOAST size of the table?

A table toast size goes from 7.5Go to 9.2Go in one hour. The normal database activity seems not responsible for that: no more queries than usual. To be the cause, it would need a larger amount of ...
Slim's user avatar
  • 237
-1 votes
1 answer
44 views

In Postgres, can I CLUSTER by multiple indexes?

I want to order the records in my tasks table according to completed and then according to workOrderID, just like I can to with the ORDER BY clause of a SELECT query, so that this taskID workOrderID ...
aswine's user avatar
  • 143
0 votes
1 answer
21 views

How to COPY table privileges dba_sys_privs into different table in Oracle

i want to copy table privileges dba_sys_privs in table A to new table B. i have create table B. What left now was it's table privileges'. Kindly advice. Thanks
Ahmad Hasanul Ishraf Shuib's user avatar
0 votes
0 answers
37 views

SPLIT RANGE ON A TABLE

I'm trying to create a job that executed automatically the rotation of partitions on a table. I executed the next script but the ranges are not rotating successfully DECLARE @PARTITION_FUNCATION_NAME ...
Carolina's user avatar
0 votes
1 answer
39 views

Json or separate column?

I'm developing a table structure to store the physical activity data and users can save their progress. The activities belong to multiple programs. like beginner program suppose be like having 1000 ...
Vidya L's user avatar
  • 101
0 votes
0 answers
39 views

how to create a duplicate table with the same constraints as the original in Oracle

I usually create a duplicate table like this: CREATE TABLE TEST_NEW AS SELECT * FROM TEST; This does create a replica of the original table, however, the constraints aren't replicated. is there a way ...
datascinalyst's user avatar
0 votes
1 answer
32 views

Proper way of copying larger data from another Azure database?

Being the 3rd party that is allowed to read from the Azure SQL (in cloud), we need to simulate access to the data as in the older version of the ERP that used plain old MS-SQL server. Only the subset ...
pepr's user avatar
  • 143
1 vote
0 answers
35 views

Database Design for Tickets: Single Table with Conditional Fields or Separate Tables

I'm working on designing a database for a ticket management system, and I'm looking for guidance on the best database schema for my use case. The system allows tickets to be created by either a ...
pi3o1416's user avatar
1 vote
2 answers
626 views

How to optimize a query on a large table, besides using index?

I need suggestions/ideas of optimizing the following query: SELECT COUNT(*) FROM (SELECT 1 FROM f WHERE parent_sha256 = $1 AND parent_sha256 <> sha256 LIMIT 1) AS ...
KaliTheGreat's user avatar
0 votes
0 answers
6 views

Handling clunky join condition (Newbi)

(Newbie question I think) [Not a mission critical issue just for my understanding]. I have a situation where I have two SharePoint tables as follows: Table 1: UserTable: user, Position, Department, ...
Todd Wantz's user avatar
0 votes
1 answer
122 views

Receiving error "ORA:22905-can not access rows from a non-nested table item" while working with ref cursors in JSON in PLSQL

I have created below procedure. I am getting ORA:22905-can not access rows from a non-nested table item at last line : INTO JSON_DATA FROM TABLE(InvoiceDetails). What I am doing here is retrieving out ...
Niki's user avatar
  • 1
0 votes
0 answers
61 views

Dynamically selecting a table in a query based on result from joined SELECT

I have seen many examples but they don't match with my special case (I know... everyone's case is a special case :D ) I have to match values from different tables, some of which are named after the id ...
jprealini's user avatar
  • 101
0 votes
1 answer
320 views

Finding when columns are added- SQL Server

In SQL Server is there any way to get information about when columns are created and which columns are new? Also, I need to find any change in columns, for example which columns' data type changed. I ...
Farid Zahidov's user avatar
0 votes
0 answers
23 views

Help with design using ltree on PostgreSQL

Currently designing a database to register animal species (Sharks and relatives) 1 table will hold species (name, attributes, and relative information) I will have the taxonomy hierarchy for each ...
Tiago Conceição's user avatar
2 votes
1 answer
58 views

Constraint checks on multiple association tables vs. unique association table that centralizes these constraint checks

I have the following database schema (MySQL 5.7): I have assistants that may be linked to either: one customer (might evolve to multiple customers in the future, hence the association table) one or ...
Merinorus's user avatar
0 votes
1 answer
37 views

Flyway Migrate - External Table Create Throwing ORA-00922: missing or invalid option

We use flyway in our company to make changes to the various regions. The guy who set all this up is unfortunately left the company so I don't have anyone really to run this past. I have a bit of SQL ...
mcquaim's user avatar
  • 11
0 votes
2 answers
49 views

transparently splitting a single table so the program doesn't notice

I am using homeassistant with mariadb. This is hosted on a Pi 4 with 8gb of RAM I have been collecting data a long time, and a single table grows to 20gb. The storage is a M.2 NVMe via USB 3. CPU ...
cybernard's user avatar
  • 141
0 votes
0 answers
37 views

Drawbacks of using a single table to hold all relations

Say I have a simple user table that has some unique columns like id and email, and a "level" column that defines the level of the user, such as admin, or moderator. Level is a fixed set of ...
Alex's user avatar
  • 165
1 vote
1 answer
115 views

Column containing keys from columns of another table

I have two csv files, countries and birth_rate_stat with the following data: ISO ISO3 ISO_CODE FIPS Display Name Currency Name Phone_Code Region Code AF AFG 4 AF Afghanistan Afghani 93 Asia AX ALA ...
Red Tornado's user avatar
1 vote
1 answer
24 views

Table Schema problem, column with multiple dependencies

I have a product table shown below: CREATE TABLE( Id_Product INT PRIMARY KEY, Product_SKU INT NOT NULL UNIQUE, Product_Name nvarchar(100) NOT NULL, Product_Section ...
VVT's user avatar
  • 11
3 votes
1 answer
108 views

Selecting second highest value using two SQL queries returns different results

I have the following tables from which I am to select the second highest salary: Table 1: id salary 1 100 2 200 3 300 Table 2: id salary 1 100 I wrote two SQL queries to achieve this: Query 1: ...
Imad Ahmad's user avatar
1 vote
0 answers
108 views

Auto Increment ID based on 2 columns

I have table called Logs. it has 4 columns ID, USER_ID, USER_TYPE, USER_ACTION where USER_ID is unique USER_TYPE is unique for every USER_ID and USER_ACTION can be anything 1,2,3 or A to Z. USER_ID ...
Zoheb Patel's user avatar
0 votes
1 answer
85 views

table inheritance: TPH, TPT and single table vs taxonomies

according to this post and many others web resources, you can do table inheritance with Table Per Hierarchy Inheritance, Table Per Type Inheritance or Single table (single table for all sub classes). ...
Giacomo M's user avatar
  • 151
0 votes
0 answers
14 views

GIS database table setup with multiple columns or FK

I am trying to design a environmental GIS table setup in a geospatial database. The workflow process is to create a Permit To Disturb (PTD Table) and for each PTD there will be a point, line and ...
Christian Leidersdorff's user avatar
0 votes
0 answers
62 views

Move data from existing column to new columns in Sequel pro

I need help with my SQL table, so thank you in advance for any comments. My table in Sequel Pro (example): Object Time Intensity . A. . 1. . 100. . A. . 2. . 150. . A. . 3. . 300. . B. ....
Serffest's user avatar
0 votes
1 answer
100 views

unable to add data to a table in mysql, Error Code: 1054

##Created table using the following line: create table sales ( product_id int, sell_price float, quantity int, state varchar(20) ); ##Tried to input values using the following line insert ...
AAYUSH SHEKHAR's user avatar
0 votes
2 answers
128 views

Separate tables for logging?

I would like to log new products, updates to products and deletions of products (and the same for other schemata [customers, locations etc]). Would it be best to have a separate table (e.g. ProductLog,...
Basil's user avatar
  • 131
0 votes
1 answer
93 views

create table based on another table

I have a table called " Product " it has: ID_P, Name, expiration date Now I want to create another table called "Stock" this table has ID, Quantity_of_the_product, ...
kylie's user avatar
  • 41
0 votes
2 answers
233 views

Exec An SQL query in a table in Database 'B' from database 'A'

i have this Table sequence_data in database A . The table has create script for sequences . No I want to create all these sequences in another database B. If it is the same database i can just use a ...
Viz Krishna's user avatar
1 vote
2 answers
99 views

Help - Database design

We are implementing the new requirement in our current web application. If we discuss the database design for the new requirement, it appears to be more complex. Requirement - We have two webforms; ...
Rahul Hendawe's user avatar
1 vote
1 answer
69 views

SQL Server find records that have the same data and keep one

I have a table containing Services (service_id) for different Packages(package_id) I am trying to find Packages with the exact same Services and keep only one Package of them dummy_id package_id ...
PanosPlat's user avatar
  • 521
0 votes
0 answers
59 views

How do I get a big-picture feel for my database?

Background: I was just granted access to my company's SQL Server (MS SQL 2019 via Azure Data Studio). As I have not yet been assigned any specific projects I want start digging. I've asked my DBA to ...
Hogan Marhoefer's user avatar
2 votes
1 answer
44 views

How to combine three tables for a queue in each Store in each town?

Sorry if my question is no appropriate for DA. I have a State-city table with unique id for every town/city name. (id: town --> city --> State) I also have a list of Store names associated to ...
C.F.G's user avatar
  • 131
3 votes
1 answer
852 views

Returning table name and schema name along with column values

I have table in SQL: public.employee name age abc 20 xyz 30 I want a query which would return the column values along with schema name and table name. Input: select * from public.employee Output: ...
CoderAkki's user avatar
1 vote
0 answers
43 views

Table for an Appointment App

experts, I am building out an appointment scheduler application. I am seeking advice on how best to tackle this issue. I am building out my ERD and I am the point where I will be creating a ...
Isaiah Melendez's user avatar
0 votes
2 answers
315 views

How to use foreign key, to remove subentries?

I try to delete all the subcategories and entries within this subentries, when i delete the main categorie from within one table. If i had multiple tables, i would use a foreign key with ON DELETE ...
Angled's user avatar
  • 13
0 votes
1 answer
769 views

how to run trigger on table on postgresql except one column

I'm using postgresql 13/14. lets say I have a table with column A,B,C,D,E I have created a trigger for the table that would run every insert/update/delete. (but in this problem, I only need it for ...
Fire's user avatar
  • 1
0 votes
0 answers
22 views

P&T: which approach to take with app constantly creating new tables

A customer is complaining about low performance. No cpu or memory bottlenecks observed on the system. The problem is that their app is constantly creating new tables that are used for a while, then ...
trustno1's user avatar
0 votes
0 answers
59 views

SQL: How to do column operation on existing tables in database and create new table from it?

I am fairly new to SQL so may not be using correct terminology for my question. I have got test data in database identified by part number in a "partNo" column. Each row of the "...
jam_27's user avatar
  • 1
0 votes
1 answer
19 views

Is it valid design to relate different but similarly structured data to resources using composite keys?

I have been taking an approach on small applications for some time now where I have a very similar data structure that might apply to more than one different type of resource. To avoid making ...
JRhodes's user avatar
0 votes
1 answer
2k views

SQL Summing a column value based conditional on another table's value

I'm working on a SQL query that returns a SUM of a value in a column/table based off a related value in another table's column being met. I'm getting an error: The multi-part identifier "Charges....
user avatar
0 votes
1 answer
672 views

DEFERRABLE not working as expected in Postgres

My app has the requirement that every table has a "created_by" column that references to the id column of user table. Even the user table. That means the created_by column would be a ...
Alex's user avatar
  • 165
0 votes
1 answer
55 views

How do I sync MySQL DB table

I have 9 MySQL servers in different environments. One of them is in the testing server. That one will be the first server if I have to make the change. Is there any way I can sync the table from the ...
ITnewbie's user avatar
  • 111
-3 votes
1 answer
793 views

Retrieving range of values from a lookup table using SQL

I am using SQL Server. I have two tables Result and Grading. Using T-SQL select statement, from the lookup table (Grading),I want to fill Grade column in Result table with the knowledge of range of ...
Tariq bin Farooq's user avatar
1 vote
1 answer
433 views

Flatten a JSONB file - What function/query

In a bit of a pickle at work - I have a Jsonb which I need to flatten a file that has similar structure: { "Manufacturers":[ { "manufacturer":"Tesla", ...
NasahT's user avatar
  • 25
0 votes
0 answers
42 views

Keeping a table up to date that has been created using a DB Query

I have created a new table view for customers, so that when they log in, they only see the information that they need to see... I used the Query: CREATE TABLE IF NOT EXISTS Customer( SELECT ColumnA, ...
PaulMcF87's user avatar
  • 167
2 votes
1 answer
211 views

Getting all shared values of two or more given values in one table (SQL)

I have a chat database where each user belongs to a chat; this relation is represented in the table "is_member(uid, cid)". Now, when creating a new chat, I want to check if there is not ...
Hape's user avatar
  • 23
1 vote
1 answer
78 views

Data modeling for employees with manager's record updated weekly

I would like a best practice or some direction on how to handle employee data, as I just took ownership of the database management The table employee looks like this id employee manager week score 1 ...
David Salomon's user avatar
2 votes
1 answer
640 views

Mysql - Table structure to hold history log without any primary key

I have mysql table that holds log data for some products, this data are deleted and inserted by a service every 5 minutes. This is the table: | id | product_id | dev_stage_id | production_order | log |...
SilentRage47's user avatar

1
2 3 4 5
11