0
votes
1answer
12 views

Optional oneToOne relations and criteria field

Introduction: Visitors can fill reports on my website. Those report can either be filled by a legalPerson or a naturalPerson. Constraint: I don't like empty fields and I would like to normalize as ...
-3
votes
0answers
39 views

SQL Architect - HA [on hold]

We have different office has its own set of legacy databases for functions like HR, Finance etc. While each office has fortuitously chosen the Microsoft application stack, that they have, until ...
2
votes
2answers
206 views

Checking whether two tables have identical content in PostgreSQL

This has already been asked on Stack Overflow, but only for MySQL. I'm using PostgreSQL. Unfortunately (and surprisingly) PostgreSQL does not seem to have something like CHECKSUM table. A PostgreSQL ...
1
vote
1answer
14 views

Restarting a Publisher involved in Merge replication

Our hosting provider would like restart the SQL Server that a publisher in a merge replication topology. I'm not able to clearly understand best practice for doing this from the Microsoft docs. Our ...
0
votes
1answer
49 views

Update primary key column - NULL issue

I want to update a column that is a primary key using this code use BITS_TEE Update DMT_TEE_DTS_Production set ABCIndicatorCode = ( select HIST.ABCIndicatorCode from ...
2
votes
1answer
47 views

Inconsistent MySQL query execution times

We run tests on two servers: one in production [Old Server] and the other one in tests [New Server]. Both tests used the same database. [New Server] Dedicated MySQL 5.6.17 server on Ubuntu 14.04 ...
2
votes
1answer
28 views

WHERE attribute having two relation lines in the same SQL

I have a database designed with tree tables: checklist (id, name) tag (id, name) checklist_tag (checklist_id - FK, tag_id - FK) Running this SQL: SELECT cc.id as checklist_id, cc.name as ...
2
votes
1answer
41 views

Conditionally join table

I'm new to database design and have designed a database that seems fine for the application but looks like it has a major red flag to me. I have a master table which is then joined to another table ...
0
votes
1answer
40 views

Case always returns null?

I have a subquery that gets the DATEDIFF of two dates. However the first case always returns null yet the actual sub query returns dates?! CASE WHEN [date1] > [date2] THEN ...
0
votes
2answers
57 views

Reading Data from SQL Server database

I want to read data from each cell of database. If the corresponding value is encountered then I have increment a variable count for that corresponding variable. Consider the following table Ques1 ...
0
votes
0answers
11 views

utf8mb4 in SQL Server Express

We have some web applications based on databases using utf8mb4 as character set and utf8mb4_Standard as collation. We saw that we can use any character we want with this setting. In SQL Server ...
0
votes
1answer
62 views

Need to get the first 15 rows from 200k rows of data fast [on hold]

I have 3 tables with a lot of data (each one has 100k rows). I used UNION to get data from that. It takes more than 5 seconds as wait time in server to load the first page. I need only 15 rows from ...
0
votes
2answers
27 views

Get the table affected by the query

How I can get the table which is affected by the query? Example Update cust Set name = 'john' Where custid = '4001' Output: cust ___________________________ Insert into emp(fname, lname) ...
0
votes
1answer
20 views

Get the most present elements from many fields

Here is my table: id|item0|item1|item2 --+-----+-----+----- 1 | 10 | 12 | 12 2 | 12 | 68 | 13 3 | 15  | 13 | 10 I just want to get the most present number of all itemX columns. The query ...
0
votes
1answer
15 views

Can I Create a Database and Tables in One SQL Command From PHP?

I tried separating the CREATE DATABASE and CREATE TABLES commands into different mysqli_query statements. The Database gets created but I get an error with: $create_tables = "CREATE TABLE ...
0
votes
2answers
35 views

How to import into database when records contain multi-line data

I am setting up a new database and I want to import lots of data from multiple spreadsheet files. One of the fields in these documents contains an array of data, each item declared on seperate rows as ...
-5
votes
1answer
38 views

How to fix the SQL from SQL Server to Oracle? [on hold]

There is the SQL using in SQL Server: select l.depart_code, l.depart_name, y.HR_NO, y.HR_NAME, m.PAY_SCOPE, x._per, x._com from psr_main m, hr_depart_data n, hr_depart_data l, (select ...
0
votes
1answer
24 views

How to query group for increase or decrease in value

In MySQl I have a table positions and I would like to find out if position of certain app for certain feed in a certain country type has been increasing/decreasing and by how much from the last ...
0
votes
1answer
18 views

How to get data of two column from two table?

I have two Table MATCH_MASTER and TEAM_MASTER MATCH_MASTER |---------------------------| |M_ID | TEAM1_ID | TEAM2_ID | |---------------------------| | 1 | 1 | 2 | And Another table ...
0
votes
1answer
30 views

How to safely add column to replicated mysql database

We have 2 databases, one is a replication used for read only, with around a million records, we want to add a new column to the master db, to one of the tables. Do I just go on MySql workbench and ...
-2
votes
1answer
58 views

Errors writing MySQL Queries

I'm having trouble writing some MySQL queries. I have been having a lot of trouble getting these queries to work. a) For each class that has at least one qualified professor to teach, list the number ...
1
vote
1answer
19 views

Troubleshooting Resource Governor / Classification Function

I've been trying to configure / troubleshoot the resource governor on a sql server 2014 instance. I can't get any work into anything but the default resource pool. I've been following this ...
0
votes
4answers
50 views

Whether Logfile Shrinking is good or bad one for Performance in SQL? [duplicate]

I am using SQL Server 2008 R2 database and in that we have more than 70 databases. In a few databases I can see the log file size is more than 10GB. I am shrinking the log file size on a daily basis ...
0
votes
0answers
26 views

Automatically Transfer Files From server to Database [on hold]

How would I go about transferring files from a server to a database in another server automatically? People access my server, when they do various information gets sent to my server such as ...
0
votes
2answers
62 views

View with left joins are very slow

I have a view based on join of 3 tables and and query on view is taking 10 mins to fetch the results. Can anybody help me in reducing the time taken to fetch results? VIEW CREATE view ...
2
votes
1answer
19 views

Performance impact of Extended Events filter [like_i_sql_unicode_string]

I have created an extended events session in which I wanted to see all queries using nolock hint. I have decided to use it instead of sql trace in order to minimaze possible performance impact. ...
0
votes
2answers
52 views

How to change schema so that account_id reference is unique among 3 tables

Original image: Updated to have more-correct terminology and an 'is_debit' column: I am designing a (PostgreSQL) schema for a lottery website that uses double-entry accounting. 'jackpots', ...
0
votes
0answers
31 views

Wrapper function with SECURITY DEFINER is slow

I have a strange behavior of wrapper function with SECURITY DEFINER option. Function 1 - Queries data what is not directly accessible by user. Function 2 - Is a wrapper that calls function 1 with no ...
0
votes
0answers
31 views

How can I decrease FULLTEXT initialization time?

I'm trying to decrease execution time of the a query. Using SHOW PROFILE, FULLTEXT initialization takes about 0.3, which is too high. Other values are at normal level. How can I decrease FULLTEXT ...
4
votes
1answer
79 views

Splitting a csv column from select query into multiple columns

I have a stored procedure SELECT [ShipWorks].[dbo].[OrderItem].[Code] AS Code, CASE WHEN (LEN(ISNULL(MAX([ShipWorks].[dbo].[OrderItem].[Location]),'')) = 1) THEN ...
0
votes
0answers
8 views

Error in 'Master Database Restore' in SQL Server 2012 (Because of difference in SQL Server Build)

I have a backup of a master database that was taken from SQL Server 2012 11.00.2218 build. Now I have a new SQL Server installation with build 11.00.2100. I tried restoring the master database after ...
2
votes
1answer
35 views

Can SQL Server stop me from running an UPDATE statement without a WHERE clause?

Whenever I have to run an update statement, I always get nervous that I might forget the WHERE clause and overwrite the entire column in the database. Is there any setting or plugin or addon I can ...
0
votes
3answers
39 views

Excel - How can I use a SQL query to retrieve data on a database sever?

I have connected to a SQL server in Excel . I want to be able to import data from a table located on the server. However this table is too big to import into Excel, I'm talking millions of rows. I ...
1
vote
2answers
55 views

How to construct a set-based query for subset problem?

I have a DB of the following structure (picture shows simplified version) How should I construct a query to get only those recipees, that can be cooked, i.e. for each ingredient in a receipe ...
1
vote
2answers
37 views

Optimize rows to columns conversion

I have a big Oracle table (around 40 million rows) that looks like this: ID Name Question Answer Reason 3 Name1 1 Yes blah blah 3 Name1 2 No NA 3 Name1 3 ...
0
votes
0answers
9 views

The OLE DB provider “Microsoft.Jet.OLEDB.4.0” has not been registered

I am getting the error as follows : The OLE DB provider "Microsoft.Jet.OLEDB.4.0" has not been registered. I try it on google .I have install AccessDatabaseEngine.exe but no use it is used for 64 ...
1
vote
0answers
23 views

Merge/combine two queries with different dates

I have one query that runs a SUM statement based on daterange 1, and worked fine, and another query that run same SUM statement, but on a different date range. I would like to merge/combine the two ...
0
votes
1answer
26 views

Query to join three tables

I have three tables which I have to join. I'm not a good SQL writer. Can please sombody help me to prepare this using joins: branches ----------------------------------------- branch_id | branch_name ...
0
votes
3answers
51 views

Matching two rows in a single table if two specific keys have different values

I have a table called settings in that there are two columns and data like following. settings value ------- ------ depots 12 projectid 156 client ...
0
votes
0answers
19 views

SQL Server 2014 Install Not Creating Default Instance [duplicate]

I am trying to install SQL Server 2014. The problem that I am having is that during the installation it is not letting my choose whether I want to use a default or a named instance. I have been ...
0
votes
3answers
98 views

Why is my select statement so slow?

SELECT name FROM sys.databases WHERE name not in ('master','model','msdb','tempdb','ReportServer','ReportServerTempDB','1303VISBOC') AND CASE WHEN state_desc = 'ONLINE' THEN ...
1
vote
0answers
36 views

MySQL fulltext selection performance

I have 1.5M rows in a table. Following is the table create code: CREATE TABLE `jobs` ( `id` INT(8) NOT NULL AUTO_INCREMENT, `job_id` VARCHAR(50) NOT NULL DEFAULT '', `title` VARCHAR(255) ...
0
votes
1answer
38 views

Last row from a query without Order by

I have something like SELECT var1,var2 FROM table where var3=X AND var4=Y order by var5 desc limit 1; Running this query takes roughly 5 seconds on my database which is far to slow. I was ...
0
votes
2answers
30 views

Update the other columns which are for to have minimum of other 2 columns , difference between 2 columns , and others

I am working on data in oracle 11g as below : subscriber_id | count_s | count_t | min_count | diff | negative_diff | positive_diff 137606401 3 3 3 0 ...
9
votes
2answers
190 views

foreign key constraint violation issue

I have identified 3 situations. A student with no enrollments. A student with enrollments but no grades. A student with enrollments and grades. There is a trigger on the enrollments table to ...
3
votes
2answers
102 views

How to figure out Disk I/O by table

Is it possible to figure out which tables contribute the most to read / writes operations if all of them in same file? I been looking at the following DMV SELECT * FROM sys.dm_io_virtual_file_stats ...
1
vote
1answer
48 views

SPARSE Column in SQL Server

I have just learned about SPARSE columns in SQL Server. I have never used them; I've just read about it on the Internet. Can I ALTER an existing Nullable column in large transactional tables to ...
1
vote
2answers
98 views

Inner Join or what else?

What I have Table A Table B ID ID_Fruit ,,, so on ID ID_Fruit ID_CRATE DateTime 1 1002 i_1 ...
-1
votes
0answers
24 views

What is role of adaptive server in sql server? [closed]

When we run a stored procedure, Adaptive Server what will do.
3
votes
2answers
88 views

How to avoid the SORT operation in SQL query that contains ORDER_BY condition?

I am optimising a PostgreSQL query which involves three tables and a ORDER_BY condition. It seems that PostgreSQL prefer to arrange a SORT operation to perform the ORDER_BY condition, rather than ...