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

I'm trying to run an oracle database in virtual box under oracle linux

I'm trying to run a oracle DB in VirtualBox and access it from my host mac OSX , i am using port forwarding to access my guest, I can telnet my guest on the port, however when i try to connect from ...
0
votes
1answer
43 views

SQL tables relations

i'm making a MySQL data base , my tables are: users, activitylog, activitytype. to avoid repetitions i thought about including activitytype in each activity which is logged into activitylog table, ...
0
votes
1answer
63 views

How different clauses treat Null/Unknow in SQL Server 2012?

(relatively new to SQL and SQL Server) I am reading SQL Server 2012 T-SQL Fundamentals by Itzik Ben-Gan. Autor states that: SQL has different treatments for UNKNOWN in different language ...
0
votes
1answer
35 views

how service sid operate under the covers?

This question is out of curiosity and it left me in confusion whether service account as any role to play in sql server startup and shutdown? Can anybody explain how sql server 2008 Service Sids work ...
0
votes
0answers
22 views

How to generate TPC_DS queries for Oracle?

I have downloaded the DSGEN tool from the TPC-DS web site and already generated the tables and loaded the data into Oracle XE. I am using the following command to generate the SQL statements: ...
0
votes
1answer
54 views

advantages and disadvantages of using direct sql querying in application [closed]

could people please give their opinion on and give advantages and disadvantages on the use of sql queries directly within an application as opposed to creating procedures or functions within the ...
0
votes
1answer
17 views

Nesting inner to sum inner query's result

Suppose I have a query select a,b from xyz The result would be: a        b m1     10 m2     20 m3     30 Can I somehow ...
1
vote
2answers
52 views

Filter by value or show all if no value

I have 2 tables: records and access_rights Access table has list of permission for certain and should be used to filter records based on rules: function field is mandatory object field is ...
0
votes
1answer
42 views

MySQL DB structure with Main category and several nested sub categories

I am looking to create a set of fields on my webpage identical to what eBay uses on their category selection page when you are selling something. For my purposes I am doing motorcycles, power sports, ...
3
votes
2answers
100 views

select all rows with a minimum value

In Sqlite 3 I'm trying to figure out how to select rows based on a minimum value. I think that I'm limited by not knowing enough of the related terminology to effectively search google. The table ...
10
votes
3answers
381 views

Can IS DISTINCT FROM be combined with ANY or ALL somehow?

Is a postgres way of combining IS DISTINCT FROM with ANY or some other neat way of getting the same result? select count(*) from (select 'A' foo union all select 'Z' union all select null) z where ...
0
votes
1answer
63 views

Beginner table design

I have been coding in C# for a couple of years where I usually try to follow the 'single responsibility principle' which states that each class should ideally be responsible for only 1 goal. Now I ...
1
vote
0answers
118 views

Empty Space in buffer pool

I was doing some reading and came across this article from Paul Randal: http://www.sqlskills.com/blogs/paul/performance-issues-from-wasted-buffer-pool-memory/ Using the queries from that article, I ...
2
votes
2answers
166 views

How do I Delete A Database And Log Files With SQL 2008 Script?

While working on making an automated Delete and Restore script for my backups I ran into a snag. I can not delete the database; however, the delete button works exactly how I need it to. Can anyone ...
0
votes
1answer
61 views

PLS-00049 bad bind variable when compiling a trigger

I'm trying to implement a dedupe trigger to a table. CREATE OR REPLACE TRIGGER USER.TBL_ACTION_DEDUP BEFORE INSERT ON USER.ERRORTABLE REFERENCING NEW AS NEW OLD AS OLD FOR EACH ROW BEGIN IF ...
0
votes
0answers
83 views

SQL Server 2008 single-line PIVOT/UNPIVOT combo

I have a request to get information from a table with a stored procedure that shows all the necessary data for in one line. This table includes a hierarchyID, so I am trying to use the HID methods in ...
2
votes
1answer
129 views

What is the difference between MySQL and PostgreSQL in terms of writing SQL queries? [closed]

Other than performance and security is there really any difference between MySQL and Postgres like SQL queries, built-in functions, procedures and so on? I'm asking this because I'm familiar with PHP ...
0
votes
0answers
38 views
0
votes
1answer
30 views

Why does Oracle store time in DATE column?

I have a table with a date column. I used JDBC to save a java.util.Date object into the table. When I run following query I get date aswell as a time value: select To_CHAR(departure_date,'DD-MM-YYYY ...
1
vote
2answers
40 views

MySQL: Is it possible to order a query by a specific letter using ORDER BY?

What I'd like to do is order my query so that the results show every row found, but are ordered by showing results that begin with the letter 'D' first. Is this something that is possible to do with ...
8
votes
3answers
205 views

When a previously-fast SQL query starts running slow, where do I look to find the source of the issue?

Background I have a query running against SQL Server 2008 R2 that joins and/or left-joins about 12 different "tables". The database is fairly large with many tables over 50 million rows and about 300 ...
2
votes
1answer
98 views

Oracle Standby Database Techniques for faster application of redo logs

I am quite new with the concept of standby databases in Oracle and I am not really a DBA, so help me out. I have been reading a bit on the concept of Oracle standby databases and I am pretty much ...
7
votes
1answer
102 views

Deleting large amounts (4 million rows) of mysql data efficiently, on a very regular basis

We have a mysql table that at any given time has about 12 million rows. We need to delete old data to keep the size of the table somewhat manageable. Right now we are running this query daily, at ...
1
vote
1answer
44 views

complex update query postgres

I've got a bunch of ids from table messages and I want to update the table activities. This is how I imagined my query would work (so you get better idea what I'm trying to accomplish): update ...
2
votes
1answer
28 views

DB2 SUM / INNER JOIN question

I have a query that is the following: SELECT CMSTKY AS Customer, CMNAME AS BusinessName, WKMDL# As Model WKSLD# AS Sales FROM GPCMP INNER JOIN GPCM1P ON GPCMP.CMSTKY = ...
0
votes
2answers
117 views

Recommendations for a SQL Server 2014 Database Administrators Course [closed]

I am after some personal recommendations for a SQL Server 2012 Database Administrators Course with exams. Exam 70-461: Querying Microsoft SQL Server 2014 Exam 70-462: Administering Microsoft SQL ...
1
vote
1answer
191 views

Can I rely on this SQL shortcut to save a query?

Consider a table with a status field that holds one of two values: | status | set('active','default') | YES | | active | I need to know how many records are in the table, and additionally how ...
0
votes
1answer
45 views

rownum won't return records above 100

I have this query: SELECT * FROM ( SELECT v.*, ROWNUM recnum FROM ( SELECT hostaddress, modulename, severity, escalation, classification, ...
0
votes
1answer
30 views

Query causing Database lock problem (php/Mysql) [closed]

hi friends can anyone tell me what is the issue with my query. when i execute, it lock the Database for 5 to 10 minutes, please help me to optimize this query . SELECT u.username, ...
0
votes
1answer
54 views

Recommendations for how I should create my table based on data given?

I'm asking this as I'm kinda overwhelmed by the data presented to me (I'm still fairly new in programming and SQL). Basically I need to create a database to store warehouse equipment information, and ...
11
votes
1answer
506 views

GO After every T-SQL statement

What is the reasoning behind using the GO statement after every SQL statement? I understand that GO signals the end of batch and/or allows the reputation of statements but what advantage does it have ...
0
votes
0answers
21 views

How can I number my groups using an Access “Find Duplicates” Query?

I have a query created by the MS Access 2010 find duplicates wizard. It is: SELECT * FROM fbExpenses WHERE [expense_date] In (SELECT [expense_date] FROM [fbExpenses] As ...
4
votes
2answers
113 views

Order of columns in a compound index in PostgreSQL (and query order)

I have a table with 50K rows. It is actually a PostGIS table. The query has 4 parts (1 mandatory) (3 Optional) intersection box (a geography rectangle) with 4 lat,long (I use st_intersects) ...
2
votes
2answers
60 views

SQL Server - Recursive “find all FK connections for ID through the entire DB” query

I'm dealing with a DB with hundreds of tables, with interconnecting FK references producing potentially thousands of different permutations for how for example table A and table K can join together. ...
0
votes
1answer
23 views

Select cleaned Adress Data in an Database

I have 80.000.000 Entries about Persons. They are built up like: Max;Mustermann;Examplestreet;50;9900;City 88000 is one ZIP Code, 8800 Zip Codes exist. I want to find out the entry based on ...
0
votes
1answer
23 views

Check whether MySQL Innodb Rows are compressed

After setting the various variables to enable compression on the Innodb Barracuda tables, what query will you use to check that those tables are indeed compressed?
0
votes
0answers
51 views

Postgres vs MySQL Database Maintenance

I have been using Postgres and MySQL for a long time now. There are a few routine maintenance chores that must be performed on a regular basis to keep a PostgreSQL server running smoothly. As as ...
0
votes
0answers
46 views

Firebird-Time Interval- between 2 Dates

I try to select the period of employment for the members in a Company. Example: Date of join: 01.01.2001 Today: 27.02.2014 Now, I want this: 13 years, 1 month and 27 days I have a Statement which ...
5
votes
2answers
148 views

SQL Server 2000 - 'Performance: Deadlock'

We had to restart our SQL Server today, we had made no changes to it. When it came back up we immediately started getting this error from the server DATE/TIME: 2/27/2014 3:09:31 PM ...
2
votes
2answers
43 views

Table Transformation with SQL?

I got a set of tables which have been imported into a database by transforming them like shown in the following picture: Now it is necessary to get the former tables back. Unfortunately the guy who ...
0
votes
1answer
53 views

Error 1005: Can't create table can't find where the problem is

I have created a EER model using MySQL Workbench (latest release). Apparently all is fine but when I try to do a FORWARD ENGINEER I get the common Error 1005: Can't create table. As suggested in this ...
0
votes
1answer
42 views

Execute SQL query after execute TRUNCATE in a table

I have a table called fos_user_user where I have a default record "always". Since I'm testing all the time and sometimes I need to clean that table I'm asking if there is any way to run the following ...
1
vote
2answers
179 views

What is the difference between logical schema and physical schema?

While going through Database architecture I came across Schema's . I am very much confused with: Logical schema Physical schema How these two schema exist in the Database? How can these be ...
0
votes
2answers
28 views

Having DB Mirroring and Replication together

Can anybody help me understand why do one go combination of Database Mirroring + Replication. Why can't I just have Database mirroring for high availability of my database. What is the need of ...
-2
votes
6answers
250 views

Missing import function in SQL Developer like MS Access has

At my work we used to use MS Access now we are forced to use SQL developer to create queries and export the data. Details: We can only query to the database We cannot create a new database We use ...
0
votes
0answers
31 views

query comes in slow query when log_queries_not_using_indexes is enabled

This query comes in slow query log when log_queries_not_using_indexes is enabled. SELECT a.id, d.id AS city_id, d.city FROM booking a, sub_area_master b, area_master c, city_master d WHERE ...
-2
votes
1answer
34 views

Is it completely pointless to use NOT NULL after DATE types? [closed]

From my current knowledge and experience, it is not possible to insert NULL into a DATE type, so what would be the point in declaring NOT NULL at table creation? I see this quite often throughout ...
1
vote
2answers
41 views

Nearest value for each foreign key

I have a table with a primary key, timestamp, value, foreign key. I would like to find the nearest value to a timestamp for each of the foreign keys in a list. Unfortunately, the gap from the given ...
0
votes
1answer
18 views

Is there a more efficient way of using a match score in MySQL full text search?

SELECT i.*, MATCH(i.description, i.keywords) AGAINST ("searchterm") AS score FROM items AS i WHERE i.instock=1 AND MATCH(i.description, i.keywords) AGAINST("searchterm") ...
3
votes
1answer
69 views

Postgresql query slowed with table growth

I have a very simple table in Postgresql, and need some guidance to speed up my queries. Recent large expansion of the data in the table has made everything grind to halt. Table body_feature: ...