Tagged Questions

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)

1
vote
1answer
42 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
54 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
15 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
49 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
152 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
1answer
74 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
2answers
53 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
46 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
41 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
26 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
30 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
1answer
8 views

SQL Server : low disk space impacts CPU?

Is there any relation between disk space and CPU utilization? We experienced the issue with very high CPU utilization on SQL Server 2008. At the same time, we were in lack of free space on the ...
0
votes
1answer
61 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
29 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
77 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
18 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
37 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 ...
1
vote
1answer
28 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
37 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 ...
0
votes
0answers
15 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
28 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
20 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 ...
0
votes
2answers
25 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
125 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 ...
18
votes
3answers
768 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
13 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
27 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 ...
1
vote
1answer
46 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
49 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
222 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 ...
2
votes
2answers
16 views

PostgreSQL query slows due to ORDER BY even with an index

I have the following query to find offices that service a given area. When I run this query without the "ORDER BY" clause, it takes a less than 0.1 seconds. When I add the ORDER BY clause, it takes ...
1
vote
1answer
16 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' = ...
0
votes
1answer
51 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
37 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
1answer
18 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
87 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 ...
2
votes
1answer
6 views

ANSI SQL for links

Oracle provides a "link" mechanism in order to access a different database instance than the one on which the query is running. DIM_DATES@OTHERDB Is there any ANSI SQL standard way to code this?
0
votes
0answers
27 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
51 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
258 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 ...
0
votes
0answers
45 views

SqlServer: can one table's PK be the FK of two table's?

I have three tables project, users and proj_user. The PK of proj_user table is the FK of project and users table's pk e.g.(project_id,user_id) My question is, is it possible if the project_id and ...
0
votes
0answers
23 views

Postgres - Combine similar queries with extra where clause

I am trying to combine a number of fairly time consuming queries into one (if possible) The database contains race-track data that records the times for laps completed by drivers (or users here), the ...
-2
votes
1answer
59 views

SQL Server procedure optimisation

I need to optimize the procedure below (SQL Server 2008) and badly need help: I am thinking to reduce search space o Splitting the joins and create intermediate (smaller) results o Force the most ...
0
votes
0answers
22 views

Exporting data using SBIDS

I have created lots of SQL reports using Microsoft Visual studio (from BIDS as part of the SQL package). I am running 2008R. When I export the data I would like to export to Access instead of the ...
1
vote
1answer
40 views

why doesn't this parameterized sql return anything while the non parameterized one does?

I have tried to use sql parameter on one of my queries and noticed when ever i do so, it just doesn't return anything! while the none parametrized one works just fine. Why is it ? None parametrized ...
2
votes
1answer
53 views

Sum Actual in different period

I have the following table test : test is a table that contains the number of week , start and end day of each week for a month WeekOfMonth StartDate EndDate 1 2014-05-01 ...
1
vote
2answers
208 views

What is causing my Transaction log to grow

The TLOG in my SQL Server 2008 is growing faster than usual. The DB has a Full recovery model and we have a TLOG backup every hour. Can you please write me or refer me to link that describes a way to ...
0
votes
1answer
13 views

Compare sysdate month with a column data

im application developer and we are using Oracle database for this project. I never used oracle before so i want some help to build a simple query. I have a CARD table with these columns EXPIREMONTH ...
0
votes
0answers
23 views

Recursive query to break time intervals into standard-sized parts

I'd like to write a reusable function which takes 3 arguments a timestamp start_time a timestamp end_time an array of intervals interval_array such that each interval (except the first) divides the ...
0
votes
3answers
182 views

Alternatives for a LEFT OUTER JOIN query

Problem I have a SQL statement with an LEFT OUTER JOIN which works fine on our Microsoft SQL Server. My problem is that i have to be compatible with H2 Database and this one got a bug with OUTER ...