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.

learn more… | top users | synonyms (1)

0
votes
0answers
20 views

bit column vs multiple join tables

Hi all I asked a question earlier about how I could define a many to many relationship between users and FOSes (fields of study). My original question was how could we know whether the user was the ...
0
votes
0answers
19 views

Aggregate query on multiple values of same field [migrated]

I am using sql server 2012, I have a table of credit card transactions as follows: CardScheme RespCode ========================= Visa Declined MasterCard Approved MasterCard Approved ...
5
votes
2answers
25 views

Turning OFF CHECK_POLICY by default

We moved from SQL Server 2000 to SQL Server 2005. The client software, which I can not change, creates a user without option CHECK_POLICY = OFF; After creating a user, I have to run the command ...
-2
votes
1answer
45 views

Handle vast amount of data in DB [closed]

Now my current database is working in SQL Server 2008 R2 and we are uploaded its only in 1 server. How can I migrate my existing database in to Hyper Table ? (My current database has huge amounts of ...
-1
votes
2answers
38 views

Load Balancing in SQL

We are implementing new database applications with large users and the developer thinks we need to look into doing some kind of load balanced SQL database.our server is slow due to vast amount of ...
0
votes
0answers
25 views

Data model for an educational database [closed]

I am creating an educational database. I would like to link concepts together in a way that is nearly analogous to the way elements link to form molecules. First, we would create a table of ...
6
votes
2answers
200 views

Is a bad practice to create a transaction always?

Is a bad practice to create a transaction always? I mean is a good practice to create a transaction only for one simple select. how much is the cost of creating a transaction when is not really ...
1
vote
1answer
13 views

Restoring database backup file gives access error

I am running SQL server 2008 and trying to restore from a backup file. Note: the backup file and folder and read/write access to "everyone". Running the command as "master" Running RESTORE ...
0
votes
2answers
65 views

How do you store tabular data in an RDBMS?

First: I really haven't got any idea how to google for this. If you got one, leave a comment. If I want to store arbitrarily large tables in a database, how should I set up my database tables? ...
2
votes
1answer
27 views

How to select nodes where all children is satisfied?

I have a tree structure of light bulbs. I want to turn on all the light bulbs starting from the leafs of the tree. A light bulb cannot be turned on unless all its immediate children are turned on. ...
4
votes
3answers
49 views

Check server activity with code

I would like to see the activity on of the SQL server. So I can run a query when the server load is low. I know there is an activity monitor in SQL server but my company doesn't want me to give the ...
1
vote
3answers
59 views

Shell: How to time a script running in SQLPlus and kill it after x amount of minutes?

I have a little tool which automatically runs a series of SQL scripts when and outputs to .XLS when an appropriate request is made. However, some SQL scripts need to be ran on a live database, and I ...
0
votes
1answer
51 views

validate where each parent intermediary is also a parent to itself [duplicate]

I want to validate where each parent intermediary is also a parent to itself. So this query should return invalid parents in SELECT If table has any. I need to do is first of all get all parents ...
0
votes
0answers
16 views

Data Type that automatically stores the DateTime of the last transaction done, SQL Server 2008 [migrated]

I need to add a new column to an existing table, so that whenever a new row is added, or an existing row is edited, this column will be filled with the exact date and time of the transaction. I tried ...
0
votes
1answer
32 views

Multiple junction tables?

I am working on a system where you have users, and you have Fields of Study or 'fos' for short. Each user can have many fos and each fos can have many users. So we are dealing with a many to many ...
1
vote
1answer
10 views

Mysql query grouping by two columns for max date takes too long

I have table that looks like this: l_p l_a l_timestamp l_n l_act l_name 123 321 2011-1-1T01:00:00Z B q das 21 23 2012-1-1T01:00:00Z C q sd 123 ...
-1
votes
0answers
41 views

which database suitable for huge inserts for analytics system [closed]

I want to develop a analytics system for very high traffic web sites, that records many behaviors of users. I want to choose a proper database for doing it well. This database must suitable for huge ...
0
votes
1answer
53 views

Remove specific duplicates (all but latest)

When removing duplicate rows, using the below query from this tutorial, how would I go about forcing which of the found duplicates to remove? DELETE FROM dbo.ATTENDANCE WHERE AUTOID NOT IN ...
9
votes
3answers
389 views

Updating a table with millions of records, its been 4 days

I am currently updating a table with millions of records, its been 4 days and query is still executing. I checked the activity monitor its shows that query is running. In event log there is no ...
3
votes
3answers
167 views

Are individual queries faster than joins?

Conceptual question: Are individual queries faster than joins, or: Should I try to squeeze every info I want on the client side into one SELECT statement or just use as many as seems convenient? ...
0
votes
0answers
26 views

Longest prefix search in Oracle

I have a list of phone number prefixes defined for large number of zones (in query defined by gvcode and cgi). I need to efficiently find a longest prefix that matches given number PHONE_NR. I use ...
-2
votes
0answers
43 views

SQLYzer experience [closed]

recently found and installed the 30 days free trial version of Precise SQLYzer (just google it and you'll find it easily). I tried it on my UAT env and so far I find it really great. I'm wondering ...
2
votes
1answer
48 views

SQL Windowing function to create a running total

I need some help with windowing functions. I have been playing around with sql 2012 windowing functions recently. I know that you can calculate the sum within a window and the running total within a ...
1
vote
0answers
51 views

Which database could handle storage of billions/trillions of records in sql? [duplicate]

We are looking at developing a tool to capture and analyze netflow data, of which we gather tremendous amounts of. Each day we capture about ~1.4 billion flow records which would look like this in ...
1
vote
2answers
49 views

Join on different types

In a database I have two tables: The first has a field named taxonomy_id that is an integer The latter has a field named ID that is a character varying The two tables are related: if it exists a ...
1
vote
2answers
66 views

Remove scientific notation from an XML column

I have a XML column as shown below: <Root> <Row> <Rowid>1</Rowid> <date>2013-05-06</date> <Balance>1.0002E7</Balance> </Row> ...
0
votes
1answer
35 views

Upload (someone else's data) to Postgres, SQL Server [closed]

I work for a company that does program evaluations for state agencies. Thus, I frequently work with someone else's data. They send me the data via sftp:/, mail, etc. and I load it into either SQL ...
-2
votes
0answers
31 views

How can I group sql rows by hours? [closed]

My table: tbl_questions => qid question detail mcid cid uid answercount dateposted status showname emailnotify question_type_id I would like to get all rows group by hours. {dateposted = Y-m-d ...
1
vote
0answers
54 views

Search for multiple keywords related to separate columns on a single table

Imagine I have a table with the schema shown. Each of the columns represent a searchable collection that I would like to be picked up in the search. I am looking for a method that would derive the ...
2
votes
4answers
90 views

When should I use the shrink option

I have seen a lot of blogs stating that shrinking is not a good habit as it will reduce the performance of the system. I agree with all those things it will lead to side effects like fragmentation, ...
0
votes
2answers
51 views

How to forcibly flush the undo log/tablespace of UNDOTBS1

I'm looking for a way to flush the undo logs so that the UNDOTBS1 doesn't give me an error saying that my tablespace isn't large enough. I tried using a commit, but without success, it still gives me ...
0
votes
0answers
17 views

Where condition execution sequence in MySQL [duplicate]

I am using MySQL 5.0.88. I have a query like select DISTINCT party.­id FROM party­ LEFT join party_­identifier AS pi ON pi.­party_­id = party.­id­ WHERE ­(pi.­source_­note=? AND first_­name LIKE ? OR ...
2
votes
2answers
42 views

Postgres 9.2 select multiple specific rows in one query

I have a table with three columns, Id Serial. Value real. timein Timestamp. I want to select the values based on a range of days ie. from two days ago until now. The table may contain one or two ...
4
votes
1answer
65 views

How to get a row_number to have the behavior of dense_rank

I have a stored procedure will be used to page through data. One of the requirements of the procedure is to have a parameter that will be used to sort two columns of data, the sorting should be used ...
-1
votes
0answers
36 views

How can I delete duplications with one query? [closed]

Is there any way to delete duplications with one, or only two queries? I'm not good with SQL. Now I'm trying this solution: $le = mysql_query('SELECT * FROM tbl_answers'); while($i = ...
2
votes
1answer
32 views

How can I include more query in one query?

These are my tables: tbl_answers => aid qid answer uid dateposted emailnotify namedisplay status isbestanswer tbl_questions => qid question ...
0
votes
1answer
20 views

Separate table by often changed / not often changed data?

I have a application which querys different gameservers, and stores for example if the server is online, and how many players are connected. But of course there is also data which is changed rarely. ...
0
votes
0answers
29 views

Simple SQL statement [migrated]

I've been over-thinking this too much. Let's say I have a table TEST(refnum VARCHAR(5)) |refnum| -------- | 12345| | 56873| | 63423| | 12345| | 56873| | 12345| I ...
2
votes
2answers
30 views

MySQL many to many relation

Sorry is this seems a stupid question, but I have a table of server addresses and a second table with a list of hardware devices which use the addresses, it is possible for multiple devices to use the ...
3
votes
1answer
51 views

Convert SQL Server 2012 SSIS package to 2008

I've created a few SSIS packages in SQL Server 2012 that I need to run on SQL Server 2008. I've been told that it is impossible in their current state. Is there a way to convert the 2012 packages to ...
3
votes
6answers
109 views

Backup very large table

I have to update certain values of a large table (for the sake of a presumed example, it is called 'Resource' and it is over 5M rows) and thus I have to make a backup before performing the changes. We ...
1
vote
6answers
58 views

Best practices with large amount of data

I'm building a solution and I have a question. All my data is currently stored in a unique table. Each row of data is associated with a type. My question is, what's the best practice for defining a ...
6
votes
2answers
83 views

Is there any way to trace optimizer's work in MySQL?

Just like the MEMO structure in SQL Server which is kind of a "paper trail" of steps the optimizer takes in optimizing the query. Is there anything in MySQL through which I can get the information ...
4
votes
2answers
73 views

Should I use a composite or single-column index?

I have the following columns in my database table (Medicines). ID bigint, MedicineName nvarchar(50), BrandName nvarchar(50), MedicineCode nvarchar(20), and price,quantity. I am making a stored ...
-1
votes
1answer
44 views

Adding a column at a specific position using DBMS_REDEFINITION

Can anybody tell me how I can add a column to table at a specific position using the DBMS_REDEFINITION package from Oracle?
0
votes
0answers
30 views

Match two large tables finding similar data [closed]

I have two tables in MySQL. Table 1 contains much data, but Table 2 contains huge data. Here's the code I implement using Python import MySQLdb db = MySQLdb.connect(host = "localhost", user = ...
1
vote
1answer
28 views

Moving postgresql data directory

I moved postgresql's data directory by following the following steps: Stop postgres cp -a source_data_directory destination_data_directory export PGDATA=destination_data_directory Changing data ...
-5
votes
0answers
45 views

Query for Oracle database [closed]

I have a problem in writing a Database Query Problem: I have the below fields in my table Fields: Primary_ID(PK) ,E_ID, Bank, REQUEST_STATUS, START_DATE, STATUS Data: REQUEST_STATUS may contains ...
-4
votes
0answers
42 views

oracle database query [closed]

I have a problem in writing a Database Query Problem: I have the below fields in my table Fields: Primary_ID(PK) ,E_ID, Bank, REQUEST_STATUS, START_DATE, STATUS Data: REQUEST_STATUS may contains ...
1
vote
0answers
33 views

How to Change location of postgres cluster and database within the same machine? [duplicate]

I have my present database cluster of postgres at /mnt/my_hard_drive which I want to change to /home/myfolder. I also want to move all my databases present in the present cluster to /home/myfolder. Is ...

1 2 3 4 5 42