All Questions

0
votes
0answers
5 views

Function: Use text/varchar parameter as a query

I have a query that I use in different parts of a system. Now I want to make a function wherein it accepts a text to be used as a query, I'm pretty sure that this is not possible. However, I want to ...
0
votes
0answers
4 views

How to optimize query based on explain analyze in postgresql?

I am running the following query via EXPLAIN ANALYZE but it is taking a bit of a long time to run. Based on the output of explain analyze, what are some things I can do to my table to make this query ...
0
votes
0answers
6 views

Find multiple rows that share one field value but have one unique value

I have tables cards, decks, and a join table card_decks. I want to find the count of a unique set of pairs of cards where the a given attribute is true. I feel like I'm close but there is another step ...
0
votes
0answers
5 views

Can someone help me with this PL/SQL block?

Write a PL/SQL block to display the details of five employees who are getting the highest salary (table name is Employee) Is this how you do it?? DECLARE Cursor C is select * from Employee ORDER BY ...
0
votes
0answers
5 views

Postgres full join with subqueries and aggregation

I have this query that sums the monthly total and running total for some data in a range. It works as expected. drop table if exists data cascade; create table data (id int, start date, "end" date, ...
0
votes
0answers
5 views

Teradata 'Column Dictioanry Name' and 'Column SQL Name' definitions and differences between them

With the following sql query Teradata shows a lot of information about the columns of a table. HELP TABLE Database_Name.Table_Name; Two of them being Column Dictionary Name and Column SQL Name. ...
0
votes
1answer
6 views

Permission Error when trying to import SQL

On an attempt to import an SQL into a Database I get this error. * Error 0xc002f210: Preparation SQL Task 1: Executing the query "IF NOT EXISTS(SELECT * FROM sys.schemas WHERE name..." failed with ...
0
votes
0answers
6 views

How to restore output from pg_dump into a new table name

I am dumping a large postgres table (~15m records) like this: pg_dump -h myserver -U my_user --table=mytable -Fc -Z 9 --file mytable.dump mydb The above creates a mytable.dump file. I now want to ...
0
votes
0answers
4 views

PL/pgSQL: NEW.field = value; does not work in AFTER UPDATE OF trigger

I have the following instruction in my code NEW.field1 = value_for_field1; The trigger, which is defined as following CREATE TRIGGER mytrigger AFTER UPDATE OF field1 ON table1 FOR EACH ROW EXECUTE ...
0
votes
0answers
6 views

select based on list of pair

I have a table with two main columns, id1 and id2 drop table if exists pairs; create table pairs (id1 int, id2 int); insert into pairs values (1,2), (1,3), (3,1), (2,4), (5,4), (3,6), (7,8); I ...
0
votes
0answers
9 views

Missing right parenthesis after (or before) default 0, Oracle

I am trying to create a table with oracle SQL two columns of the table should have default value and should not be NULL. I am getting the error you can see below, but i am not able to understand it ...
0
votes
1answer
9 views

JOIN in 4 tables gets phpmyadmin unresponsive

I can´t manage to create a valid query that shows me 5 columns from these 4 tables: As you can see the relationships that i'm trying to JOIN in the query are highlighted in differents colors. The ...
0
votes
0answers
3 views

optimal (price) solution in aws for write-heavy read-infrequently key/value store?

Apologies in advance if this question is too vague. Admins: feel free to delete if so. Background: Copious amounts of user activity data streamed to S3 File size ~32 MB Record size ~1k; format = ...
1
vote
2answers
14 views

SQL Server Index Maintenance-Conditional Rebuilds

I have a question about index maintenance. I have a weekly process that does all of my database checks, etc. and a weekly rebuilding of indexes. Those rebuilds have been causing some locking pressure ...
0
votes
0answers
3 views

UnrecoverableRollbackError: need to rollback, but unable to determine common point between local and remote oplog

I have a three member replicas set all running Mongo 3.6: One primary, one secondary, and another secondary with a slave delay of 1hr. The secondary with the slave delay is constantly crashing every 3-...
0
votes
0answers
11 views

Table structure for a revisioning with auditing system

For an assignment I have to build an application that is able to store tests. Every test has to be validated by a a different user when created or updated. When it has been validated by an user, the ...
1
vote
0answers
10 views

Get a list of categories per row using a MariaDb Select Subquery

I am new to MariaDB, I have a list os stores that are categorized by one or more categories. I need to show a Json representation of this structure. How can i, using Maria DB, get a list of ...
3
votes
0answers
24 views

How to know which DMVs relate to each other?

Is there any way to know which DMVs/DMFs are related to each other? Some of them are well known or obvious, like sys.dm_exec_connections JOIN sys.dm_exec_sessions ON session_id = session_id, or the ...
0
votes
1answer
15 views

Get not matching record as null while joining two queries

I have two queries having same columns, 1 returning 3 rows and other returning 2 rows. While I join this two query I am able to get only 2 rows. How can I get three rows with not matching record as ...
0
votes
1answer
18 views

Postgresql running total

I have a bunch on time entries, they have entre_dates and hours associated with them like so. drop table if exists data cascade; create table time_table (id int, entry_date date, hours numeric); ...
2
votes
1answer
38 views

SSMS refuses to start

I've recently installed SQL Server 2017 Express and SSMS v18.0 on my home computer (Windows 10) and at first this worked fine. However, after a reboot, SSMS flat out refuses to start. No error message,...
0
votes
1answer
15 views

Is “--one-database” safe to use for importing from a dump?

If I make a full dump using mysqldump --all-databases > dump.sql and then I want to import just a single database, I can use mysql --one-database db1 < dump.sql. According to the documentation, ...
0
votes
0answers
8 views

PostgreSQL cluster has two primary databases after network glitch

My test environment had network glitch over the weekend and I ended up having two Primary databases up and running in the cluster. ID | Name | Role | Status | ...
0
votes
0answers
2 views

Reconfigure PostgreSQL Installation

On Windows (10), is there any way to reconfigure a PostgreSQL installation, specifically when the --with-openssl option was not used? I'm hoping to avoid having to backup, reinstall, and restore ...
-3
votes
0answers
11 views

The multi-part identifier “transact_clntab.ACCT_CODE” could not be bound

FROM transact_clntab t, CLNTAB ct LEFT JOIN clntab ON ct.ACCT_CODE = t.ACCT_CODE group BY t.acct_code HAVING MAX(t.trade_date) < '2015-01-01' AND MAX(t.trade_date) >= '2008-01-01' Please,...
0
votes
0answers
21 views

Differences Between Setting Up Transaction Log Shipping through Wizard vs Scripts

There appears to be a fairly significant difference after setting up transaction log shipping (in Standby/ Read-Only mode) through the SSMS wizard, which generates jobs that then call on outside .exe ...
-1
votes
0answers
14 views

Oracle 12.2.0.1 Data Guard instructions Step by Step

Can anybody point me to a document which they have followed to successfully implement new Data Guard on following environment : - Oracle 12.2.0.1 - non-multitenant I have tried a few resources on ...
1
vote
1answer
29 views

Are there relations that cannot be normalized to second normal form (2NF)?

I came across this example that I can't normalize to 2NF, so I was wondering if relations that could not be normalized existed. Here is the example relation: R(A, B, C, D, E) with the functional ...
0
votes
0answers
18 views

How to test a master key regeneration?

Following up after a situation on an important LIVE server - where I have the master key backed up, but the decryption password for that master key backup file is missing. I can't open the master ...
-5
votes
0answers
26 views

Joining column to another table [on hold]

I am having trouble joining this query (TRANSACT_CLNTAB) with another column in another table (CLNTAB) The common column is ACCT_CODE FROM transact_clntab t group BY t.acct_code HAVING MAX(t....
0
votes
0answers
8 views

To check duplicate email ID while new user register in database -php-mysqli

I am using the following code so that when it will check the duplicate email ( if already registered in database) it should give email id already registered. But it is not showing that however it go ...
2
votes
1answer
13 views

Determine if columns in postgres table are inherited

I want to be able to list out the columns in a child table and see which ones are inherited from the parent table and which ones are defined on the child table. SELECT column_name, inheritied FROM ...
0
votes
0answers
6 views

Details about existing roles and users in azure sql database

I would like to get details of all users existing in a sql server DB and the respective roles they are part of and the permissions granted/denied for the a role/user. what is the best way to get this ...
0
votes
1answer
13 views

Combine Multiple primary databases to single AlwaysOn AG

Can i combine 2 different databases like db01 database from server1 and db02 database from server2 to single AG group on DR ? Version : SQL server 2016 enterprise edition
0
votes
0answers
22 views

CSV to SQL Import Script

I have CSV log files generated every 10 minutes automatically. I would like to know the best scripting method to automatically import the CSV file to mysql and put the data in the correct table by ...
-2
votes
0answers
14 views

Join column to multiple columns in another table

I want to join this query result TRANSACT_CLNTAB with columns in another table CLNTAB SELECT t.acct_code FROM transact_clntab t group BY t.acct_code HAVING MAX(t.trade_date) < '2015-01-...
0
votes
1answer
11 views

Application performance

I need to have users table in which each user has one of few different types (ex. admin, manager, basic user etc.). So my question is: Is it better to just make an attribute in user table and fill ...
0
votes
0answers
8 views

Maximum query length in SQL Phpmyadmin

I am running a very long query in mysql and it is throwing the error It seems that the connection to server has been lost. Please check your network connectivity and server status. I have searched ...
0
votes
0answers
17 views

Update local SQL Server database table with data from remote SQL Server database table

I have two SQL Server Databases (Version 14.0), one on AWS and other on local in house server. I want to update some of the tables from the AWS server to local server in following two ways: Update a ...
0
votes
0answers
10 views

'go to symbol' in Allround Automation PL/SQL Developer?

I really like using my PC just by keyboard and any time I have to use a mouse is a real pain for me. I really like 'go to symbol' feature in VS Code or Sublime Text, so I can navigate through any ...
0
votes
0answers
8 views

“Connection contains host name” - SSIS packages run locally but not on Azure

I am trying to make SSIS packages using Visual Studio 19 that import data from tables in a remote database to a Microsoft Azure SQL DB database, aiming to schedule these to run weekly on Azure Data ...
0
votes
1answer
10 views

Create a generated column from the last 100 occurrences for a given user ID

I have Three tables, Table1 stores post engagement rate (rate_new_1) for Social media posts (shortcode) Table2 stores post information including taken_at_timestamp the third table Stores information ...
2
votes
2answers
193 views

'Select @VAR =' and 'Set @VAR =' behaving unexpectedly

Working on a database i didn't setup myself i was digging through some stored procedures to find out what they were doing. In here i found numerous variables being set through a SELECT @var =, I ...
0
votes
0answers
8 views

Mongodb throwing an error when I run the query to record last position from oplog

I am getting an error when I run the query in the secondary member to record the last position from the oplog. below is the query. db.oplog.rs.find().sort({$natural:-1}).limit(1).next().ts and the ...
0
votes
0answers
16 views

ORACLE : Query optimisation - How to optimize query by replacing “order by” and few row fetch after ordering

Below is the join query where in query takes time mostly for "order by" and fetching top few rows after ordering. SELECT * FROM ( SELECT q.* ,ROWNUM RN FROM ( SELECT T1.X,T2....
0
votes
0answers
21 views

Can I to clear v$archived_log where name is null?

I have noticed that when I exclude some archivelogs with rman the view v$archived_log still keep the registers and when I gonna restore I receive this errors: RMAN-00571: =============================...
10
votes
1answer
198 views

Physical only checkdb is failing, but full one is completed successfully

I am executing checkdb with physical_only option and it fails with multiple errors like below: Msg 8965, Level 16, State 1, Line 1 Table error: Object ID 1557580587, index ID 1, partition ID ...
0
votes
0answers
9 views

ORA-01502 during insert

So I have a table with an index on a RAW datatype column. And then I have a procedure which disables all indexes on that table, truncates it, and then inserts data into it. After that it enables all ...
0
votes
0answers
19 views

How to migrate Oracle 11g on-premise database to Oracle 18c cloud? [on hold]

As per my knowledge, Oracle 18c can be installed as on-premise database. But what is actually cloud database? Is it that we download and install 18c on any AWS kind of cloud platform or is it that 18c ...
0
votes
1answer
29 views

Is it possible to exclude rows from a select based on conditions of another row

My data set is quite simple; Ref Value Voucher No ------------ ---------- ---------- M019922 -154.80 100081968 M019922A 154.80 100081968 M019922B -154.80 ...

15 30 50 per page