An acronym for "Structured Query Language" (it's not the name of a specific DBMS product), SQL can be used in relational database management systems (RDBMS) to query, update, delete, and insert data as well as modify the structure of the database. It can also be used to manage schemas and data ...

learn more… | top users | synonyms (1)

0
votes
0answers
12 views

Multiple Trace Files or Replay

I am just wondering how useful the replay functionality of SQL profiler is. The issue I have is that I can capture a workload from production with little overhead, however I would not be able to ...
1
vote
1answer
89 views

MySQL: Which join is better between left outer join and inner join

Which join is better peforming if all of them provides the same result? For example, I have a two tables employees(emp_id,name, address, designation, age, sex) and work_log(emp_id,date,hours_wored). ...
0
votes
0answers
38 views

How do I select the latest rows for all users? [migrated]

I have a table similar to the following: => \d table Table "public.table" Column | Type | Modifiers ...
1
vote
1answer
111 views

Efficient way to insert/update/delete table records from complex query in Postgres 9.x

I have this function which returns a set a records and I need to persist those records into a table. I have to do it hundred times a day. My initial approach was just clear data from my table and ...
1
vote
1answer
114 views

PostgreSQL 9.3 - Performance Issue: Counting table entries slower with jdbc postgres driver

I'm using PostgreSQL 9.3 and want to ask if it is possible to improve the performance of my queries based on the following database schema: CREATE TABLE "entities" ( "id" BIGSERIAL, "type" INT ...
1
vote
1answer
57 views

Combining count queries into one table row

I'm banging my head against the wall because I'm sure this is super easy. I have a few queries set up that get counts for a few related tables. This is for an arcade game tracking system. The ...
1
vote
1answer
121 views

Cannot open database “user_auth.mdf” requested by the login. The login failed. Login failed for user 'web_user'

I am trying to deploy my first VB.NET application on GODADDY. I created a SQL server database and was able to create tables using SQL Server Management Studio. I created a user web_user and was able ...
0
votes
1answer
57 views

Any way to get database data back?

So I've entered a couple hundred rows of data into a database manually and have begun implementing a Java frontend. However, I got an unexpected result and now when I go back into RazorSQL, the ...
0
votes
1answer
53 views

sql expiry date use Trigger OR Schedule a Job

I have this table : Now, i like the way when the date expires. EndTime < GETDATE() expire field is true. What method should I use? use a trigger to true or a schedule job that run before run ...
1
vote
1answer
64 views

Execution Plan in Microsoft SQL Server

I have a stored procedure in my database. As per my knowledge it's pre-compiled subroutine. Question 1: If I execute following queries from Hibernate, will database create a separate execution plan ...
0
votes
0answers
57 views

Updating +150,000 rows using .sql file causes ERROR 2013 Lost connection to MySQL server during query

I am using ubuntu 12.04. I have a .sql file that is around 5 megabytes. When I use the command: mysql -u -p -v database query.sql The server prints out the content of the file (because of --verbose) ...
2
votes
2answers
39 views

Strategy to find the unique bivariate polynomials

I have table that stores Tutte polynomials of a large set of graphs. These are bivariate polynomials with integer coefficients. An example of a polynomial taken from Wikipedia is: Since the ...
0
votes
1answer
63 views

Text Storage and Database Design Optimization in a SQL Server Database

Given a database with a number of columns (c), where some of these columns contain text that is one of multiple values due to a set CONSTRAINT on the columns, what is the most efficient way to ...
0
votes
1answer
55 views

Modify text file with Oracle PL/SQL

I'm trying to open and replace a string in a text file with the following procedure: BEGIN v_file_name := 'text_file.txt'; v_filehandle := utl_file.fopen(v_file_dir, v_file_name, 'W'); v_id_nextval ...
2
votes
1answer
93 views

Table name with special character in the end

I have a table in database(oracle sql) which somehow contains one special character at the end which I dont know.I am trying to get that special character from its entry in table tab. SQL> SELECT ...
0
votes
1answer
40 views

Distributed transaction coordinator between SQL Server and Oracle

I'm not sure about distributed transaction coordinator so please bare with me on this, I'm probably asking this question wrong. I know distributed transaction coordinator is used in SQL Server and can ...
0
votes
0answers
30 views

Sql Server Agent Job

In my Local SQL Server 2008 I created a scheduled job (like daily email will send to particular user from the database based on condition). Now I decided to host my schedules in hosting server so can ...
1
vote
3answers
106 views

How to separate Stored Procedures (i.e. all the business logic) from Client Database so that it only contains client data?

Scenario: Our Application Database (in SQL Server 2012) contains entire business logic in the Stored Procedures (SPs). Everytime we have to publish the DB to the client, it unnecessarily results in ...
1
vote
2answers
44 views

Query for frequency of e-mail addresses in a field

Newbie here. I know the answer is out there, but lack the vocabulary to ask the right question... I am looking for a MYSQL query which gives me the frequency of addresses in the field emailaddress. ...
0
votes
2answers
262 views

How to create an oracle dump(.dmp) file using Toad?

We can export the entire database schema(skeleton) along with its data in one .dmp file using oracles "exp" tool. But how do I do it using Toad only. I can't use this C:\Users\kaunds_oliver>exp ...
0
votes
2answers
94 views

DB Design Payments Table

I'm working on a Desktop application that uses a DB to store information i.e (customers, houses, proprietors, payments). So the application must accept payments from customers to company, company to ...
0
votes
2answers
29 views

Build replication from backup not publication source

I have an interesting scenario I am trying to find a solution to. We currently have the current setup. ProductionDatabase (publisher) is the publication for transnational replication to the ...
3
votes
1answer
206 views

Formal name for functions that use the OVER clause

Is there a formal/academic name for the family of functions in Sql Server like ROW_NUMBER(), LAG, LEAD, RANK etc, that make use of the OVER(ORDER BY <PARTITION BY> ) syntax? How much of this is ...
0
votes
1answer
20 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 ...
2
votes
1answer
66 views

PL/pgSQL function or rCTE to detect depth of relations between two tables

I need to perform a PostgreSQL Function for checking the depth of relations. There is a circular binding from table a to b, back to another element in a and, in some cases back again to b. These ...
5
votes
3answers
338 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
19 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
74 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
90 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
34 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
60 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
56 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
63 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
21 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 ...
-1
votes
2answers
46 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
22 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
20 views

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

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
51 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 ...
0
votes
1answer
43 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
22 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
34 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 ...
1
vote
1answer
27 views

Troubleshooting Resource Governor / Classification Function [closed]

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
71 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
2answers
87 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
51 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
72 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
45 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 ...
5
votes
1answer
179 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
25 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
57 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 ...