All Questions

Filter by
Sorted by
Tagged with
0
votes
0answers
2 views

MySQL Simple pivot table with MAX(), GROUP BY and only_full_group_by

I'm having trouble using GROUP BY with only_full_group_by. Here is my employee_job table: +----+-------------+--------+------------+ | id | employee_id | job_id | created_at | +----+-------------+---...
0
votes
0answers
7 views

Int for identity/primary key and Guid for public identifier, best practices?

I almost always use an int for identity/primary (auto incrementing) clustered key for my tables. They're easy to query and debug, bounce around in SSMS, and plenty of other reasons. I have a case ...
-1
votes
1answer
8 views

Which is faster: using HAVING with COUNT or WHERE with IS NULL?

I have 3 tables: video, video_category and video_category_join. One video can have multiple video_category and a video_category can be associated with multiple videos: therefore the ...
0
votes
1answer
9 views

Why this query giving wrong output?

I want to find review group by ratings 1,2 etc and for doing so i write below query but this giving wrong info. This is the query: SELECT CASE ur.rating WHEN ur.rating between 0.5 and 1 ...
0
votes
0answers
9 views

The security definer of my stored procedures suddenly changed on a shared hosting server

I'm on the verge of jumping down someone's throat and want to be sure I didn't somehow cause this. I am building a website on a shared server hosted by a top-three hosting company. Last night, while ...
0
votes
1answer
7 views

how to use the same timestamp along several tables?

Lets say a have 2 tables and both have a datetime column. On table A, on datetime column, lets say, ts1, is non null, default is CURRENT_TIMESTAMP and on update CURRENT_TIMESTAMP; The other table, B,...
0
votes
1answer
7 views

Slow Query not using index in one of the tables

My Rails table structure is like this: a User has_many Contacts, which have one Reservation each, which have many ReservationNotes each. I'm trying to get all the ReservationNotes for the contacts ...
0
votes
0answers
11 views

MySQL 8 roles - I'm probably missing something obvious

I'm trying to use roles in MySQL 8, and failing. I have read the documentation and as far as I can tell, I'm doing it right. Since this is a 'hello world' level attempt, I assume I'm missing something ...
-2
votes
0answers
6 views

how to draw a ER

Pizza Hut – Sri Lanka You are required to design a DB for Pizza Hut, Sri Lanka to support the following business activities. a) Maintain details of the range of products (Cheesy onion, Chicken Bacon ...
0
votes
0answers
5 views

Column with Default value as Sum of TIMESTAMP

I have a table which has 2 columns ( JobDate , RecordTime) -------------------------------------- JobDate | RecordTime | SumCol -------------------------------------- 2019-07-20 | 2019-07-...
0
votes
0answers
14 views

How is the behaviour of backupset in RMAN?

I found this definition on WEB: A logical grouping of backup files -- the backup pieces -- that are created when you issue an RMAN backup command. A backup set is RMAN’s name for a collection ...
0
votes
0answers
12 views

can't join a freshley started mariadb galera cluster

I'm at my very first clustering experience. I need to create a MariaDB Cluster. Currenlty I have two servers but I planned to add 1 more in the future. Now, I have: maz-pihole (a debian 9 based OS ...
0
votes
0answers
14 views

MariaDB SPIDER engine

I am trying to include just one table from another MariaDB server (lets call it A) into the database on another (even physical) server (lets call it B). And I came up with the conclusion that SPIDER ...
0
votes
0answers
17 views

Most efficient way to insert records with unique sequential numbers?

The first record should have the serial number 0 (or 1) and each new record should get the next available sequential serial number scoped by a foreign key. What is the most efficient way to ensure ...
0
votes
0answers
13 views

Running a task without waiting for the results in Postgres 11 on RDS

I've got a question about spawning stand-alone threads on Postgres. Here's what I'd ideally like: Have a postgres-side solution to automatically launch tasks on a schedule in their own threads. ...
0
votes
0answers
10 views

Storing dates and their history of changes and emailing - Does my database design pose any problems?

Background I'm designing some tables to allow dates to be assigned to an object so progress can be tracked on that object, along with functionality to store emails sent pertaining to these contracts ...
0
votes
0answers
8 views

How to implement row count for REST API?

I’m building a REST API backed by PostgreSQL. I'm encountering something I don’t think is very niche, but I’m having trouble finding any discussion of it. Good REST API practice dictates that if a ...
1
vote
0answers
15 views

HQL Injection Question

This question popped into my head after reading this article. However, the more I read about this topic, the more it seems like a Dynamic SQL security issues. So i have 2 questions mainly: Is there ...
0
votes
0answers
12 views

how to search in language and get results for another language

I have two tables product |----|---------------------| | id | code | |----|---------------------| | 1 | A | | 2 | B | and product_tarnslation |...
3
votes
1answer
50 views

Sql server, altering column to smaller size

I'm doing a project that's adding some columns to a fairly badly designed table, and I noticed that it's got a lot of wasted space. I see a lot of posts about adding columns on the end being ...
0
votes
1answer
18 views

Microsoft SQL Command for Table Information (Data Dictionary)

I was wondering if someone knew the command to get the following information out of a specific Microsoft SQL Database: Table "ID" / Number (alpha-numeric order count), Table Name, Column ID, Column ...
0
votes
1answer
18 views

Can replicated commands be forced to follow each other in transactional replication?

We have transactional replication setup between an SQL Server 2012 box and a SQL Server 2016 box. Every half an hour the source table articles are altered by DELETE then INSERT sequence. This ...
3
votes
1answer
49 views

How is a T-SQL Trigger that only fires on real changes made?

I have a table trigger on UPDATE and INSERT that adds a row to another table. It only needs to add a row if one of four columns are changed. I tried using IF UPDATE(col) to test for changes but it ...
1
vote
1answer
56 views

Parameter Sniffing - Running query in code vs in management studio

I just had a problem at work where a stored proc, being called by some C# code, was very slow. When I ran the same stored proc with the same parameters in Management Studio, it was very fast. After a ...
0
votes
0answers
27 views

How to prevent large queries from causing timeouts? [on hold]

I'm finding that when I run a large query or a series of large queries the Page Life Expectancy drops and remains low and I soon see timeouts on other procedure calls. Is there any way to avoid this ...
0
votes
0answers
17 views

Left join find missing relations

Table User id, name Table Connection id, user_id, active User can have multiple connections with active fields from 0 to 3 When I do left join I am getting all connection for each user. That is ...
0
votes
0answers
20 views

How to compare rows after union

I have two tables that I want to combine. I need to be able to show all DelDates that had changes from the original (record 1) being Record 1 as the first Record and Record 0 (table 2) always being ...
0
votes
0answers
20 views

DBCC Command Not being run by current user

I have a stored Proc that runs a DBCC command CHECKIDENT The sproc is being run by a user with adequate permissions. however, it is failing on the DBCC command with the error. User 'DifferentUser' ...
0
votes
1answer
8 views

SSIS: Conditional operator in expression builder ignores previous text

Consider the following simple expression in SQL Server SSIS, where a variable is built with the following expression containing a conditional operator: "Preamble " + @[$Package::myParameter] == "" ? ...
0
votes
1answer
53 views

Rusty SQL = Heavily scratched head

I am trying to figure out the best way to sort this solution. I am trying to produce a SP (or series) to generate invoices so that the contractors know how much they will be paid. I have created two ...
0
votes
0answers
17 views

Finding matching sub values?

So not too sure how to go about this, but ideally I want to pull out matching & non-matching info from an array of rows in a table, so I have a table with info like this: 12,2019-07-15 06:02:52,...
0
votes
1answer
35 views

Sorting issue in EXEC sp_executesql

I have follow code and after I ran them in SQL Server Management Studio, I expect to get same results because those 3 parts created exact same SQL Statement. Part 3 SQL statement is created by part 1. ...
0
votes
1answer
15 views

Consequences of cascade drop on sequences/functions/views

I am migrating some data to another server while dropping all sequences/functions/views. When I try to do simply DROP VIEW | SEQUENCE | FUNCTION | AGGREGATE without CASCADE, errors are thrown to ...
0
votes
1answer
50 views

How can I combine these three queries into one result?

I'm still pretty new at SQL, so I apologize if this is a silly question. I took existing queries for three data points, and I'm not sure how to streamline them into a single output. Clunky query: ...
0
votes
1answer
15 views

Mark duplicate records on table

i've wrote the below query to update all rows as duplicate apart from the first one. I am getting an error with the aliases. Can somebody help? UPDATE `table` SET `table`.`statuscode` = '...
0
votes
1answer
10 views

Character set 'utf8mb4' is not a compiled character set and is not specified in the '/usr/share/mysql/charsets/Index.xml' file

Full error Character set 'utf8mb4' is not a compiled character set and is not specified in the '/usr/share/mysql/charsets/Index.xml' file InvalidArgumentException: There was a problem connecting to ...
1
vote
1answer
27 views

ORA-01652: Extend a tablespace in Oracle 12c, no DBA_DATA_FILES table

I know that there are other questions about this topic but reading and trying them they cannot solve my problem. Mainly because select * from DBA_DATA_FILES; shows me an error when executing, because ...
-1
votes
0answers
26 views

New table in AlwaysON Database [on hold]

Am i able to create new table in database which is in AlwaysON and does the same table will be created in secondary node
0
votes
2answers
22 views

Migrating SQL Server tables data from one application to another totally different application tables

We are migrating a few tables' data from one application to another application. These two applications are totally different tables and schema. We have created general T-sql scripts and temporary ...
0
votes
1answer
15 views

Select query with row constructors

I am using RDBMS MySQL 5.7. I have two tables with the following structures: Table A - primary table - products: +----+-----------+-------------+------------+--------+ | id | title | ...
3
votes
1answer
96 views

Available space differs between sys.database_files and database properties dialog in SQL Server Management Studio

I am looking at this for a few minutes now and could not find a thread mentioning this. I wanted to query currently used space and available space from a database on SQL Server. The numbers I query ...
1
vote
1answer
30 views

sp_help for statements

In SQL SERVER the SP_HELP 'table_name' returns a description of each column including it's type, length, nullable state etc. I'm using this info to auto-generate DTOs (classes) and mappings. If I ...
0
votes
0answers
9 views

Exception while adding node in WFC(Windows failover cluster)

recently one of the cluster node got rebooted(due to some disk corruption) and after that when we are trying to add it back into cluster we are facing exception. We tried to look for different ...
0
votes
0answers
7 views

Could not connect to the database/server apache remote mssql [on hold]

I'm stuck with this issue I ve installed Centos 7 with Virtual Box on windows 10 On Centos i wanted to upload my website on the server apache, all is done till here I ve installed mssql on centos ...
1
vote
2answers
29 views

MS SQL Server create user who can access only those databases which they have created

How to create and give permission to a user in such a way that they will have full access only to the database(s) they have created not other database(s). I am using SQL Server 2016 Express.
0
votes
1answer
22 views

Getting Values of the two rows before the selected row POSTRESQL

I want to update an row according to the values of two rows before the row how can i do that? Let's assume my table looks like this ID amount 1 1 2 3 7 5 And ...
0
votes
0answers
16 views

Query to reduce column length

I'm new to PostgreSQL so sorry if I haven't explained myself clearly! I've used the below query to find out the max character length of each column in my table. I now want to be able to shorten each ...
5
votes
1answer
171 views

Multiple BIT datatype columns in the same table

Consider the following information coming from Microsoft SQL docs pages: The SQL Server Database Engine optimizes storage of bit columns. If there are 8 or fewer bit columns in a table, the ...
1
vote
1answer
28 views

Can BCP Out cause resource contention

I had these two things running in parallel in the same database - BCP "SELECT * FROM [ServerName].[DatabaseName].[dbo].[TableName] WITH (NOLOCK)" queryout "\\LocationToMyOutputFile\TableName.csv" -c ...
0
votes
1answer
19 views

Msg 8114, Level 16, State 5, Line 1 Error converting data type nvarchar to float

I created some select statements which run without any problem in SQL Server. Then I joined them together with UNION and got this error message> Msg 8114, Level 16, State 5, Line 1 Error ...

15 30 50 per page