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
13 views

Intermittent errors when calling stored procedures with linked server references from SQL Agent jobs

Environment: Windows Server 2008 Standard without Hyper-V Service Pack 2 - 64 bit SQL Server Enterprise 2008 R2 SP2 - 10.50.4000.0 - 64 bit Problem: I am receiving intermittent failures from ...
2
votes
0answers
14 views

Checking for multiple identical values in a Posgresql array

I have a simple table in Postgresql: CREATE TABLE data (id integer, values integer[]); INSERT INTO data VALUES (1, '{1,2,3,4,5}'); INSERT INTO data VALUES (2, '{1,1,2,3,4,5}'); INSERT INTO data ...
0
votes
1answer
31 views

How can I log the way in which a job was started?

Using SQL Server Agent, I've created a Job that runs some SQL. This SQL does some work on one database, then adds a row to a logging table on a separate database. The Job is run on a couple of ...
1
vote
1answer
30 views

how to group data against more than one conditions

I have a table named Employees with below two columns. ================== Employees 1- EmpId (auto incremental id) 2- EmpName (varchar) There is another table named 'LateDays' with below five ...
0
votes
0answers
8 views

Assigning Parent Node Value using IDs

I am using iReport to build a report and I am trying to find the parent node "group_name" value based on a parent_id given, and return the value the parent, as the child's value. For example: Table: ...
0
votes
0answers
19 views

Update Duplicate record in select query of access

I have a select query (test) in access with below mentioned column ID 2561 2562 2563 2343 2561 2563 2563 Now in ID, i have duplicate records , for example here 2561 , 2562 , 2563 are ...
1
vote
1answer
59 views

Database design for an online babyShop ,Toy shop

Hi i'm designing a database for a toy shop this shop offer many products with different categories. boystoys,girlstoys,puzzles,beds,stroller, etc i designed my database as it is consists of 5 tables ...
0
votes
0answers
6 views

ORA-00838 error after increasing MEMORY_TARGET

I've increased MEMORY_TARGET in pfile and then create spfile. I'm getting the same problem as before: ORA-00838: Specified value of MEMORY_TARGET is too small, needs to be at least 3084M The ...
0
votes
0answers
50 views

Optimize query with sql server

I have the following query .its execution took 15 min .It is too much slowly . Is there a way to optimize it ? Query SELECT Id,Fees,WeekOfMonth,CONVERT(NVARCHAR(MAX), StartDate, 103) AS ...
0
votes
2answers
41 views

Complex query: find all users who rated all the movies rated by user_id='1234'

So we have the following relational schema: users(user_id, ..) movies(movie_id, ..) ratings(user_id, movie_id, rate) So, we want to find all the users who have rated all the movies which are rated ...
2
votes
1answer
25 views

Supertyping Inventory Transactions

I am trying to wrap all interactions with inventory items into one transactional table. Currently I calculate QoH by querying multiple fact tables (production, acquisition, shipment, return order, and ...
1
vote
2answers
22 views

PostgreSQL - summing arrays by index

I have an array of doubles column (double precision[]) in PostgreSQL that keeps half hour values for a day. So each array holds 48 values. I need an efficient query that is summing all this array ...
0
votes
1answer
25 views

SQL Server data, logs, backups files in mounted foldersin C:\

I know that is a good practice to have data, logs and backups files of SQL Server in diferent disk, for example D:\ for Data files, E:\ for Logs files, F:\ for backup files. But if I want to use this ...
0
votes
0answers
17 views

MYSQL Tables Join Filtering For Favorites

I am in need of some help figuring out the best way to join separate tables I am using. I am essentially trying to output a list of schools (first table in MYSQL) where one column is an empty star ...
0
votes
0answers
9 views

Ambiguous Column 'sl_no' [on hold]

I have to inner join two tables and display the last inserted record . I tried the given below code. But it generate on error "Ambiguous Column sl_no. Please help me. The code is given below: select ...
0
votes
1answer
32 views

MySQL dies when trying to access a specific database

For some reason, whatever I do I cannot access one of my databases (through command line or through something like phpmyadmin). However, the application that depends on this database is not having any ...
0
votes
0answers
19 views

How to store multiple vendor data in Google Cloud SQL?

I am designing a mobile app in which I need to host my vendor data and give access to that data after analysis to only the specified users. Since I will have multiple vendors with different set of ...
1
vote
1answer
52 views

Backup the whole SQL Server databases in one .bak file - SQL Server 2005

First I asked my question here: Migrate all databases from one SQL Server 2005 to another Many friends replied to it and I gathered lots of useful information. I have another scenario in which we ...
0
votes
1answer
14 views

SQL: Repair With Keycache

Now my MySQL server running a REPAIR TABLE, table is almost 15gb size. Status - Repair with keycache. How I can restart REPAIR TABLE with normal (repair with sort) mode?
0
votes
2answers
20 views

Subquery or multiple left joins, or both?

I have two tables, for simplicity table1, with id as Primary key, and a field name, and table2 with the same. Each table has quite a few records, but during a complicated form process, the user is ...
0
votes
0answers
35 views

SQL syntax error [on hold]

I am working with a MySQL DB. When I run the code I get the following error: Error 1064. You have an error in your SQL syntax. What am I doing wrong? UPDATE project SET STATUS = 2, REACT_TIME = CASE ...
1
vote
1answer
23 views

SQL: SOS: MySQL indexes overloads disk

My server is down now, 'couse indexes of 84GB DB are overloads disc. Here is output of df-h: /dev/ploop58097p1 193G 187G 16M 100% / tmpfs 2,0G 0 2,0G 0% /lib/init/rw ...
1
vote
1answer
28 views

How much should I care about prepared statements for simple queries?

I wonder how much I should care about prepared statements (and therefore try to optimize my code) in case of pretty simple statements. The question originates from the fact that I recently noticed ...
-1
votes
0answers
35 views

Adding numer to varchar and comparing the result with another varchar value, ORA-01722

There is an SQL Report I am working on and I need some help from the experts on this forum. The report is to find all the late comers and early going people in the place. I have to add 10 minutes in ...
0
votes
0answers
14 views

MySQL Case always executes the same [duplicate]

What I want to do is to set DATE_REACT a value when the first condition is satisfied, and a different value when the first condition is not satisfied. The problem is that the first condition is ...
0
votes
2answers
21 views

MySQL Case problem

I am trying to run a SQL code (I use MySQL). What I want to do is to set DATE_REACT a value when the first condition is satisfied, and a different value when the first condition is not satisfied. The ...
0
votes
0answers
13 views

pgAgent does not run

I referred this to set up a scheduled job and did everything as it mentioned(ran the pgagent.sql as well) I need a very simple task to run periodically. In the 'Definition' tab in the steps, few ...
-1
votes
0answers
24 views

Get records that have associations in other tables [on hold]

I have multiple tables such as dataset_tb, dataset_tag_tb, user_dataset_access_tb. I need to get datasets that have a specific dataset_type value in dataset_tb, in which there exists a record in ...
0
votes
2answers
17 views

Set of datetime versioned rows, how to build the most up to date row

I created this SQL fiddle with the sample data The sample data is this: -- -- Table structure for table `dogs` -- CREATE TABLE IF NOT EXISTS `dogs` ( `version_stamp` datetime NOT NULL, ...
4
votes
1answer
105 views

Order by bug on SQL Server 2005 vs SQL Server 2012

I have a query generated by entity framework that returns wrong results on a SQL Server 2005 db (Microsoft SQL Server 2005 - 9.00.5000.00 (X64)) but good on SQL Server 2012 (Microsoft SQL Server 2012 ...
-1
votes
0answers
19 views

SQL: How to optimize a 82+GB MyISAM Database? [closed]

I have a MyISAM DB with some content (users and admins account and thematic content). All query from PHP to my DB with mysql_ library (not mysqli!) have a mid process time 8-12 seconds, if online of ...
18
votes
3answers
632 views

Are RANK() and DENSE_RANK() deterministic or non-deterministic?

According to official Microsoft BOL DENSE_RANK is nondeterministic (RANK()). But according to Ranking Functions by Itzik Ben-Gan "... the RANK() and DENSE_RANK() functions are always deterministic". ...
0
votes
0answers
7 views

MySQL Replication problem with VIEWS and “Sub-Databases”

I've got three servers that should do a master-master replication. On server 1 i got "01_maindb" which holds the master tables. I replicate this table to the two other servers without problems. ...
0
votes
0answers
33 views

Why Sub query needed in SQL [closed]

WHAT IS NEED OF SUB QUERY. Instead of that we may use Joins. Give with example. Thanks in advance
0
votes
0answers
23 views

Accessing values of dymanic cloumn

I have a table which has 16 fields whose of alternate name to city. Below is my table structure: CREATE TABLE CITY_DATA_TO_CHK ( COUNTRY_CODE VARCHAR2 (100), REGION ...
0
votes
0answers
42 views

Splitting of database in SQL Server [closed]

One of our clients has a database larger than 3 GB and is facing performance problems. Sometimes applications will not only open because of heavy data load. How can I overcome this problem? If I ...
1
vote
1answer
42 views

Options for Index Defragmentations For Critical Tables

I wonder if this is a suitable solution for index defragmentations. scenario is like this; There is a table named 'Events' which is very critical and has 4 indexes which are not done maintenance ...
0
votes
1answer
37 views

If I assign a NVL constraint to a nullable column will it display an error or it will retrieve the records?

I have a database in which some tables have to be joined to fetch the data. The problem is that in one table the column is nullable (nullable is set to yes or no constraint given for that column) and ...
1
vote
3answers
41 views

convert nvarchar to int

I have a table in access linked to SQL.I am doing a query where I am using a field named comment from this table. The field is designed in SQL as nvarchar(255) . I am writing integers numbers in this ...
1
vote
1answer
15 views

Find the number of where statements that matched in postgresQL

Right now I have a query that looks something like this SELECT id FROM products WHERE products.details->'make' = ? OR products.details->'model' = ? OR products.details->'year' = ...
-1
votes
0answers
14 views

I'm trying to make a stored procedure to validate the input parameter [duplicate]

I want to make a stored procedure to validate if a input integer is maximum 15 digits and first digit is not 0. And I have this for now: CREATE PROCEDURE usp_verify_phone_numbers (@phone_number INT) ...
0
votes
0answers
61 views

High Logical Reads for Worktable [closed]

I have a very complex logic SQL Query which has many case statement. It is running very slow. It has 7 Left Join tables. Updated Execution Plan Link Below Statistics of sample query. what could ...
0
votes
1answer
42 views

Select complete next row based on the current row

Hi i have a complicated condition. I have a table lets say 'Test' ID Partner Type Amount 143854 CSTC Purchase -0.81 144029 CSTC Purchase -0.69 144030 CSTC Purchase ...
0
votes
1answer
29 views

SQL “select” query for getting 0 instead of null?

In the database I have some value as null . So while fetching these null value from database it should be treated as 0 not as null. Note:- I don't want to be it done by code but from SQL query.
0
votes
0answers
20 views

SQL date automatically change to next day [closed]

Im developing web application. for that application having one table, Table Name : Car_Details Field Name : departure_Date Frequency, For My doubt, If frequency is daily departure_Date is ...
0
votes
1answer
14 views

How to change the mount point for a column in postgresql table?

This is my scenario I have a table t with following columns id int link varchar(500) name varchar(20) sal text In the link column we will store the location for the pdf files(mount point) ...
1
vote
2answers
53 views

How can i resolve this problem of taking more time to execute then the previous?

I'm working in DWH environment Every day many data gets extracted transformed & loaded But from last week i see that there are taking more time then previously executed. I don't have a option to ...
0
votes
0answers
13 views

MS Access using MYSQL database and error in SQL (memo, hyperlink OLE)

I have a SQL statement that works fine in MYSQL workbench but when used in Access it produces a "invalid Memo, OLE or Hyperlink Object in subquery 'custom_values.value'. SELECT ccr1.value, ...
1
vote
1answer
48 views

AND operator in ORDER BY clause

While debugging some code, I stumbled into an error pretty much like the following: SELECT * FROM person WHERE family_size > 3 ORDER BY birthday AND registered=0; The error is that the AND ...
4
votes
2answers
168 views

Migrate all databases from one SQL Server 2005 to another

We have a production SQL Server 2005 server on which we are hosting 200 databases. We want to host these databases on our new server. On new server SQL Server 2005 is installed and is ready. I want ...