Questions tagged [table]

A data structure that organizes information into rows and columns.

Filter by
Sorted by
Tagged with
1
vote
1answer
47 views

Break down calendar table based on custom dates in SQL Server 2017

I have a table that contains the following fiscal year definitions: FiscalYear | Period | PeriodStartDate | PeriodEndDate ==================================================================...
-2
votes
0answers
14 views

could not be able to execute. unknown column in on clause [closed]

ERROR: Could not able to execute SELECT * FROM bookingTable INNER JOIN stoelen ON bookingtable.bookingID = stoelen.stoelenid;. Unknown column 'stoelen.stoelenid' in 'on clause' This is the full error ...
0
votes
1answer
15 views

How to set current sequence while converting primary key serial(integer) to bigserial(bigint)

The table already has few thousands of rows and I want to convert the primary key from Integer to BigInteger. How to change the sequence for biginteger? --Create new temp sequence (sequence-name1) ...
0
votes
0answers
43 views

Create column referencing multiple PK's from same table

I am trying to create an table, menu items, to use in my front end. Menu items can have 1 or many submenu items. So one column must be able to contain 1 or more ID's from other menu item records. ...
0
votes
1answer
29 views

Delete more than 50K records in SQL table

We have 5 Lacs records in a SQL table. Below is table structure UserID varchar FirstName varchar LastName varchar Address varchar We need to delete 50K records in this table. We tried below ...
0
votes
1answer
11 views

copy a sqlite3 table preserving custom _id

I'm trying to copy a table whose _id field is given by integers with some gaps, e.g. 1,2,5,7, presumably due to deleted messages. (This is a toy-model for a Whatsapp database I'm manipulating.) I'd ...
0
votes
0answers
17 views

Same server, same query, different response time

I have a development server that has some problem to access the data, user reporting that it's too much slow sometimes. The setup is: * virtual server; * 4 virtual CPU; * 8 GB of virtual memory ; * ...
-1
votes
1answer
29 views

Better Database Destructing [closed]

what is the best way to destruct database tables, suppose that we have two tables TRADER and PRODUCTS, what is the best way to destruct the tables: create TRADER_ID Column in PRODUCT_TABLE make a ...
0
votes
0answers
17 views

BFILE datatype in mysql

My backend is writing The Soap request within a table using a BLOB column so that I have very big tables in mysql with more of 100GB. I need store this information out of dabase in file for example. ...
1
vote
1answer
21 views

How to design two tables: A hasMany B, and one B per A has state 'active'?

Figure two tables: environments and branches. Their relationship is: one environment has many branches. This is easy with an environment foreign key in the branches table. The problem is adding this ...
0
votes
2answers
30 views

Mysql horizontalizing grouping

I have a table that essentially has rows with: sessionId date/time event event can be (to make it simple, "start" and "end") The same sessionId however can be reused, so, simply I have sessionId ...
1
vote
1answer
31 views

Get tablespace of a given table in DB2

What is the command to get the name of tablespace of a given table in DB2 database ?
0
votes
1answer
26 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 ...
0
votes
0answers
34 views

ISA-to-Table & Primary Key for Relationship Type

1).ER DIAGRAM TO RELATIONAL DATABASE 2).CAN A RELATIONSHIP TYPE HAVE AN ATTRIBUTE WITH A PRIMARY KEY? Can a relationship type have a primary key (primary attribute), like in the picture below? Can '...
0
votes
1answer
16 views

Error when assigning a role to user

I have created a role called "role1" with these steps : postgres=# CREATE ROLE role1; CREATE ROLE postgres=# GRANT CONNECT ON DATABASE paybills TO role1; GRANT postgres=# \c paybills You are now ...
0
votes
2answers
36 views

how to view data as history of field value change

Example i have data like id employeeId Salary Year 1 1 12000 2001 1 2 10000 2001 1 1 16000 2002 1 3 12000 2004 1 ...
1
vote
1answer
43 views

Manage parent/child table

I need to realize a software to manage some projects. Every project starts after a offer approvation. A offer could have many revision, but only the last one offer is the parent of the project. ...
0
votes
0answers
12 views

Trying to do a fact and dim table in Sql

so far this is what i have code wise, but im getting an error 1239 . Is it not referencing something correctly . CREATE TABLE CustomerDim ( C_CustomerID_Cu INT(10) NOT NULL, ...
0
votes
1answer
17 views

Why does the SHOW FULL COLUMNS command show the Type field in lower case?

When I run SHOW FULL COLUMNS, it shows the Type column in lower case, such as text and varchar(255). I thought these type names were supposed to be upper case (TEXT and VARCHAR), per https://dev....
0
votes
0answers
21 views

Create table with variable name and fixed columns in Postgres

I need to create a table daily with different names but the same set of columns. How can I do that? I find this do $$ begin execute format('create table "table_%s_pk" (i int)',now()::date); end; $$; ...
1
vote
1answer
27 views

Should pivot tables have more columns (many to many relationship)

I'm currently thinking about how to organize my tables, and I have some information that I'm not sure were should be, one of them is the quantity of a food in a refrigerator Is it right if I add ...
0
votes
0answers
17 views

Saving CSV data in a row with delimiters takes more time - Suggest any alternative solutions

create table dbo.import_temp ( IMPImportID int identity(1, 1), TemplateID int, UserID int, CreatedDate datetime, Status int, Data varchar, Message varchar, CommunityID int, ...
0
votes
1answer
53 views

Reducing CREATE TABLE overhead?

I have a simple SQL query: SELECT * FROM table; - a simple sequential scan - which takes me 10s. When I add CREATE TABLE AS (CTAS syntax) to it, i.e. my query is CREATE TABLE db_test AS SELECT * FROM ...
0
votes
0answers
52 views

No Tables or Views Could be Loaded

Could not retrieve the table information for the connection manager 'Excel Connection Manager 3'. Failed to connect to the source using the connection manager 'Excel Connection Manager 3' How to ...
5
votes
2answers
1k views

Table size grows indefinitely after deleting and then inserting the same data

I create a table and populate it with data: create table tab as select 'value' || level val from dual connect by level <= 10000; If I then delete all rows and insert the same data: delete from ...
0
votes
0answers
57 views

What is the difference between candidate key, super key and alternate key

I'm in IT but not in software development or database. I studied about DBMS subject 6-7 years back. I have confusion between these, candidate keys are like ideal candidates to become become primary ...
1
vote
1answer
38 views

Two substantially different but similar cases: Are they the same in terms of table cadinality?

Imagine these different cases when designing a database: Case 1: One book (only one instance of a title physically) can be borrowed by many people, but only one person at once but many people during ...
1
vote
3answers
72 views

Is it ok to add a table years in a Relational DataBase?

How can i explain my coworker that this is unnecessary complexity and redundant data? He wants to have a table of years because many tables have the 'year' value, and he also want to have relation ...
0
votes
1answer
54 views

SQL Server - How to know which tables are used and which are not?

I have a database that has 225 tables in it What is the best way to find out / log which tables are used, and which are not ? I would like to see something similar to below: Table 1 - select 2222 ...
-1
votes
2answers
216 views

Perform TABLESAMPLE with WHERE clause in PostgreSQL

I want to use TABLESAMPLE to randomly sample from rows that meet a certain condition with PostgreSQL. This runs fine: select * from customers tablesample bernoulli (1); But I cannot figure out how ...
0
votes
1answer
45 views

Does CREATE TABLE AS lock the table?

In Postgres, does this query lock films for reads and/or writes? CREATE TABLE films2 AS TABLE films;
1
vote
0answers
21 views

Set Maximum Tables In A Database [duplicate]

I need to set up a MySQL database with a maximum number of tables which can be created in it. For example, if I have my maximum at 5 tables for a single database, and someone attempts to create a 6th ...
0
votes
1answer
23 views

Creating a table in Oracle procedure [closed]

I am trying to create a table inside a procedure but getting some issues related to quote identifier or may be something else. BEGIN EXECUTE IMMEDIATE 'Create newTable as select * from oldTable'; END;...
6
votes
1answer
91 views

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 ...
2
votes
1answer
61 views

Importing a single large table in Azure

I have an existing DB called MyDb in Azure SQL Server. I have a bacpac of another DB with several tables in it. I'm interested in importing one single table (that table has no FK, it makes things ...
1
vote
2answers
48 views

How much storage space do indexes and keys take for an SQL Table?

I have a table which is predominantly filled with NULLS and takes up 10 GB which was shocking since probably 90 to 95% of the table is NULLS. I copied this table over to a new database on the same SQL ...
0
votes
0answers
5 views

Translations of names in profiles: [2 tables, one for names + one for profiles] or [one table for both, but with jsonb field for names]?

I am developing a profile module where company names could be translated (ie company may have the same name but in different languages, for example Eng/Rus for Microsoft/Майкрософт). Users may use a ...
0
votes
0answers
65 views

SQL query result table to an HTML table for email

please help me to figure this out. I need to send sql query results as html table. The challenge is that columns in this table are dynamic (most recent 5 dates). How can I replace literal column names ...
-3
votes
1answer
57 views

Transfer Mysql table data to client Server via TCP/IP by using Trigger [closed]

i Have Database on MySQL Server. I have one Table so called "log" in Database. Data has been insert in Database table automatic. I would like to transfer table via TCP/IP to the another Software. ...
0
votes
1answer
108 views

How to deny a user to access (select, insert, delete, update) to tables but grant (select) a few

i am trying to deny a user to access (select, insert, delete, update) to tables on my database but i also need him to grant only select to a few tables, to do this i created a user with login and gave ...
0
votes
2answers
97 views

Drop a 500 GB table, any consequences? [duplicate]

I need to drop a table that is 500 GB in size. It contains historical data that's not needed or used. There are no FK constraints. Any consequences of just dropping the table? I'm also using DB ...
0
votes
0answers
42 views

What's the best way to model similar tables with overlapping functionality?

I'm building a sports event/tournament/league management app for myself, and I'm stuck on the best way to model how Teams should relate to the different competition types. Some background regarding ...
0
votes
2answers
61 views

How to automate the detection of the column type of a csv file for a table creation script?

I am new to pgAdmin and Azure database. I have a huge csv file with around 220 columns and I want to create a table out of it in pgAdmin4 to push it to Azure. However I don't know how to detect ...
-1
votes
1answer
30 views

Is there a best practice design for handling different types of the same object which have different properties?

This may be a rather naive question and I am not even sure if I am asking it in the best way, so my apologies if not. I would like to know if there is a standard, or best way to handle cases where ...
0
votes
1answer
31 views

Delete comment - actually delete it, or create `deleted` column and update it?

I'm really not sure if this is the right community to ask it in, but it seemed like it fits here. But anyway, I'd like to know what's the usual approach of deleting a comment from database through ...
1
vote
3answers
98 views

Are there any reasons why a table wouldn't show in sys.dba_tables? (Oracle)

I have 2 queries SELECT * FROM sys.dba_indexes WHERE Table_Name = 'XDB$RESOURCE' and SELECT * FROM sys.dba_tables WHERE Table_Name = 'XDB$RESOURCE' Are there any reasons why a table wouldn'...
0
votes
1answer
38 views

How to count multiple occurences on the same date

my question is related to the table down below, where I have to count multiple occurences of "Hours" if they happen on the same "Date" by the same person. CREATE TABLE [dbo].[Time]( [GUIDTime] [...
1
vote
1answer
34 views

Database Model for Various Type of Sensors

I am planning to build a database that will store sensor value for various type of sensors in a factory building. Is there any best practice on how to do this? - Option 1 : should I integrate all ...
0
votes
1answer
74 views

Computed Column Operand type clash on Date Column When Checking For Null

This error is generated when trying to create a table with a computed column from a Date field. Operand type clash: int is incompatible with date If I comment out the computed column it works. [...
0
votes
2answers
82 views

Table function in oracle

I want to create a function that will return a table as a result. Now, I have written quite a big SQL that works, but as I need to push dates trough that SQL to the beginning, I need a funtion that ...

1
2 3 4 5
9