An acronym for "Structured Query Language", 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 access privileges.
2
votes
0answers
37 views
What is the equivalent of a “Certificate of Destruction” when using a cloud-hosted database?
We have a Rails application hosted by Heroku and using an Heroku Postgres database. Some of the information we store is considered to be sensitive by our users, and we've been asked if we can provide ...
4
votes
3answers
142 views
Backup strategies for zero data loss
I am working on one project and it has around 100K records. We can afford a downtime of 1 day but we need the data to be always available to us in latest state.
I've gone through two options:
1) ...
3
votes
0answers
72 views
Key Lookup and Full-text index
I have the following query:
SELECT T2.Title
FROM TitleTable T1
INNER JOIN TitleTable T2 ON T2.FKID1 = T1.FKID1
WHERE T1.FKID2 = @ID_PARAM1
AND T2.FKID2 = @ID_PARAM2
AND ...
0
votes
2answers
150 views
Large time difference between two almost identical simple queries…why?
I'm trying to understand why is there so much difference in execution time and CPU usage between two simple queries that only differ in a computation. The queries are the following:
SELECT ...
1
vote
2answers
118 views
How to find DELETE and UPDATE statements that have been executed on a database?
I am trying to find out what delete and update statements have been executed on a certain database in a certain period of time.
I came across this following query, but it generates an error message:
...
0
votes
1answer
68 views
What is the maximum number of rows in a clustered index on datetime column?
I would like know what the max no of rows is in a clustered index (non-unique) on a datetime column table in SQL Server 2008R2.
0
votes
3answers
48 views
Using MySQL InnoDB as an Archive
My site has a main MySQL InnoDB table that it does most of its work on. New rows get inserted at a rate of 1 million per week, and rows older than a week gets moved over to an archive table on a daily ...
2
votes
2answers
316 views
Check if row exists
I need to write a query that will insert a row only once, even if the query is run multiple times. Being new to SQL (well new-ish), I did an if not exists(...) but a friend said he preferred deleting ...
0
votes
3answers
125 views
Select MaxDate where hh:mm:ss makes the difference
How to select the maximum date from a table where hh:mm:ss is selected?
My query is the following, and returns the latest date, but if there are different times recorded, the date will be returned ...
5
votes
2answers
339 views
SQL Server alter table to change TEXT to NVARCHAR(MAX) greatly increasing database size
I need to update a SQL Server database thats about 18GB in size to change a significant number of TEXT columns to NVARCHAR(MAX).
The problem I'm having is after executing all the alter table ...
0
votes
0answers
44 views
Database too slow after CHARSET Conversion
I have an Oracle database which runs on version 9.0.1 with WE8859P1 charset and i'm trying to migrate it to the version 9.2i which has the WE8MSWIN1252 charset.
The conversion is made without any ...
3
votes
1answer
35 views
Creative workaround for granting edit rights to individual jobs for a group?
We have two developers that say they can not function without full rights to a few jobs on our database server. They both want rights to the same jobs.
Given that it seems that MS doesn't seem to be ...
0
votes
0answers
28 views
How can i configure sql server 2012 to use multiple nic? [duplicate]
I've a server with 4 nics.
I want to use 2 nics to query db and 2 nics to retrieve results from db
I want they work in load balancing and still continue to work if one nick is down.
It is possible?
...
4
votes
1answer
140 views
Join To a @Table Variable is running ineficiently
Alright so I have a report sproc that was running incredibly slow. Customers were complaining that the report would not run so I started investigating exactly where in the sproc the problem was and I ...
0
votes
2answers
67 views
Need a way to query a table, and JOIN it with the TOP 1 related record from an other table
As a follow up to this question, I'm wondering if there is a better and/or more efficient way to gather the data in question.
As stated, this query does return me 95% of the data I need --
SELECT ...
0
votes
3answers
99 views
Fixing a query that returns failed job information
I' using a SQL Server 2008 Sp3 environment.
I have a query that returns information about failed jobs from the last 10 minutes.
If a job has two schedulers (for example - a job that runs every 10 ...
1
vote
2answers
111 views
MySQL Replication without stopping master
I am currently setting up a replication for my database one of the ways i am thinking of synchronizing the master and slave without write locking the master, is by first taking a log position then ...
5
votes
1answer
118 views
How to improve performance on PostgreSQL when using multiple concurrent processes?
Seeing query performance which is not satisfactory on our Python application, which runs several processes that use SQLAlchemy core to access a PostgreSQL 9.2 database. We may have around 100 - 200 ...
1
vote
1answer
58 views
Question about Oracle's interpretation of “host cpu utilization” in v$sysmetric view
I am studying the v$sysmetric view from Oracle and trying to understand what is Oracle's interpretation of "Host CPU Utilization"
It says in the metric_unit as % busy/(idle + busy), but what is busy? ...
0
votes
1answer
136 views
FETCH API_CURSOR causing open transaction in tempDB
A select statement run from Oracle 11gR1 to SQL Server 2005 using Gateway leaves an open transaction in tempdb. The user is a datareader in Database XYZ. Not sure why the open tran is in tempDB when ...
1
vote
0answers
161 views
Efficiently retrieve big amount of data based on date range
Table EVENTS
TimeStamp |O.Name |Location |Source |
2008-11-12 |Pretorian|Európe |England |
2009-12-24 |Lex Rosa |Európe |Italy |
2010-01-01 |Nasdaq |USA |Whasington |
...
1
vote
2answers
122 views
Only one NULL for one part of primary key
I have two date columns : "start date" and "finish date".
I want to make sure that there can be only one null value in the "finish date" column (which should be current state if it's NULL) for one ...
0
votes
1answer
58 views
Implementation of stack in MySQL
I had an abstract idea of implementing a stack in MySQL. Tried a lot of Google work but couldn't reach to any logical conclusion.
The Stack must be a collection of tables with the stack top pointing ...
3
votes
1answer
367 views
What queries is Oracle executing, how frequently, and time-taken?
I have a (Java) web-application, that of course executes many queries (selects, inserts, updates, deletes) to the Oracle Database.
I want to find out the following for last 7 days:
SQLQuery ...
1
vote
2answers
43 views
Need logic to collate data
I have a table in the below structure.
phone bigint
answer_time datetime
I should group all phone numbers, and its total number of attempts and mention its no:of time answered and no:of time not ...
1
vote
1answer
47 views
Scheduling a backup in SQL Server 2005
I am trying to schedule back up in SQL Server 2005 with management option. I am unable to find database name while scheduling a backup with full option. Database name is not over there in selected ...
0
votes
0answers
95 views
error in creating trigger in phpmyadmin
I have 4 tables:
event:
event_id(p.k) | uid | circle_id(f.k)
activity:
uid | performed_activity_id(f.k->event_id) | activity_type_id
follow:
follower_id | circle_id(f.k)
noiticication:
...
1
vote
1answer
35 views
Hard Parse on Non-Identical Statements?
Let's say I have this query :
SELECT X FROM Y
If I run it for the first time then it would do a hard parse.
After that, I run this query :
select x from y
With just a difference in alphabetical ...
0
votes
0answers
133 views
Postgres error ( XX000: invalid memory alloc request size 4294967290 )
I'm getting the following error in my postgres 8.4 database:
XX000: invalid memory alloc request size 4294967290
Operating System : Windows 7 64 bit
Memory : 8GB
Database Version: Postgres 8.4 ...
1
vote
0answers
361 views
The Cluster service failed to bring clustered service or application 'SQL Server (MSSQLSERVER)' completely online or offline
SQL Server service restarted/stopped, which cause the production database down n find this errors in System log.
ERROR5:The Cluster service failed to bring clustered service or
application 'SQL ...
1
vote
1answer
150 views
mysql query - how to delete duplicates based on highest int?
I'm running a reverse auction website and I need to delete the duplicate bids and keep only the highest amount . lastPriceBid_rounded is the "amount". The duplicate is defined by the userId.
...
7
votes
2answers
175 views
Different results rebuilding an index online and offline
I have a non-clustered, non-unique index on a foreign key column of type bigint. When I rebuild the index online, the average fragmentation drops to 3%, with 2 fragments, and 30 pages.
When I run ...
6
votes
4answers
287 views
Is a join optimized to a where clause at runtime?
When I write a query like this...
select *
from table1 t1
join table2 t2
on t1.id = t2.id
Does the SQL optimizer, not sure if that is the correct term, translate that to...
select *
from table1 ...
4
votes
1answer
65 views
Index Evaluation
I have been doing some index evalaution on a table and this is the first time I have ever looked at how well indexes are performing so and would like some advice on a certain index.
The non ...
2
votes
0answers
41 views
Limit Output Flat File Size In SSIS
I am using Flat File Destination to export my data's to a Text file. I need to limit the output File size to 1 MB. Is it possible?
2
votes
1answer
194 views
Select the top 5 records and the specific column from each table in the same database
I have 50+ tables in a database.
I don't want to use the following SQL on each table in a database.
select top 10 * from {table_name}
So, is it possible to display the first 10 records PLUS only ...
1
vote
0answers
46 views
SQL Server 2005 Relationship [closed]
I have SQL Server 2005. Tables have relations which each others.
Some tables are libraby. 1 table has 10 foreign relations. I dont like the Database performance, a little slowly and I dont know what ...
0
votes
3answers
205 views
How to select the first 10 records for each table in the same database using sql
I have 50+ tables in a database.
I don't want to use the following SQL on each table in a database.
select * from {table_name}
So, is it possible to display the first 10 records for each table ...
2
votes
2answers
116 views
What is the difference between using varchar(100) and varchar(255)?
I want to know difference between varchar(100) and varchar(255) in terms of memory usage and programming problems of using more memory.
0
votes
2answers
55 views
some tips on setting up sql server database server
I am currently setting up a new sql server database server with databases. It is supplied by a third party company.
I need to request access for them around ports etc.
I would like to be able ...
1
vote
2answers
92 views
Suggestion for storing a lot of simple data
I'm looking to crawl a lot of webpages (500,000,000,000) records and be able to store the linking structure for a later date. The way I planned on laying out the database was as follows:
2 Tables
...
3
votes
1answer
50 views
Special ordering
I have a hierarchical query but I don't manage to order it as I want.
I have a column named sequence that indicates how to order it but the data is kinda mixed up and I cant do it properly.
This a ...
6
votes
2answers
262 views
Is there any difference between putting a column alias at the start or the end of the column definition?
I've always seen and written my column aliases as
SELECT 1 as ColumnName
but today came across a query that used
SELECT ColumnName = 1
Is there any difference in how these two queries get ...
0
votes
0answers
38 views
Connecting to an SQL Azure Database from SSMS - IP Restriction
I am trying to connect to a new SQL Azure Database via SQL Server Management Studio. The client box running SSMS is hosted on a production DB so we restrict access on 1433 to just a handful of IPs ...
4
votes
3answers
89 views
Filtering data that could have more than one category
I have a table like the following:
Annotation (
document,
term,
category
)
Where document and term are some ID, while category is an integer.
The couple document - term is not unique, ...
1
vote
0answers
74 views
Problem with order by in MySQL subquery
I'm running a query that runs in about 2 seconds when the subquery does not include the order by date_sold clause. However, when I add the order by clause, the query runs forever.
I'm confused, since ...
-1
votes
1answer
75 views
Want to show 3 tables in the same gridview and want to update/delete in parallel [closed]
Suppose I have 3 tables. But I want to show them it in same gridview and want to update and delete operations in parallel. How can I do that?
table 1: workshop
id contents demonstration ...
0
votes
2answers
66 views
How to organize a single query to several sql servers?
I need to make an inner join sql query to several SQL Servers (one is 2000 and another is 2008 R2). The query is like the following:
SELECT
k.ID, k.NAME, k.BIRTH, l.PROFILEID
FROM
...
0
votes
1answer
46 views
Faster joining on 'most recent' related rows
I have a bug tracking application. The bug table stores very little,
because every state change to a bug happens by adding a comment. For
example, the current state of a bug is determined by the state ...
1
vote
2answers
429 views
How to import table's data in MySql from Sql Server?
I am trying to export table from SQL Server 2008 R2 TO MySql 5.5. For this I am using SQL Server Import and Export Wizard of Sql Server 2008, but it is giving this error.
Here this error may be ...


