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)

-3
votes
3answers
71 views

SQL cache hit ratio [closed]

I have install SQL server, but when i check report of DB there is cache hit ratio which is 98.92%. Is it harmful for sql, if yes then how to reduce it.....? please give me solution for that. thanks, ...
0
votes
3answers
52 views

Suppress display in a column if the value is equal to the value in another column

I have 2 date columns that display side-by-side. I have some dates that are equal. I do not want to display the "equal" dates/duplicate date values in one of the columns. How do I do that? Example ...
0
votes
1answer
30 views

Script to Add a Job to a SQL Server DB

I want to add a job to my DB to make a back up weekly but i want to do it from an script, i've serched and with what i found i made this: CREATE SCHEMA job go CREATE PROC BACKUPS @dir varchar(max) AS ...
1
vote
1answer
35 views

Combine 2 tables

I am wanting to combine 2 tables. until recently the column names were different , and one had fewer columns than the other, however it was deemed unnecessary to have them as two tables. I have ...
0
votes
1answer
33 views

SQL where clause effect on table? [closed]

I have sql query as select sourceIP, sum(sourceBytes) from flows group by sourceIP order by sum(sourceBytes) desc This brings result (dummy) as:- sourceIp SourceBytes 192.168.1.2 100 ...
3
votes
1answer
12 views

Postgresql query plan differs with limit value making the query slower for lower limits

I have this query: SELECT "table_1".* FROM "table_1" WHERE "table_1"."deleted_at" IS NULL AND "table_1"."table_2_id" = 15797104 ORDER BY "table_1"."id" ASC LIMIT 1 The explain for the query ...
0
votes
1answer
32 views

MySQL Insert with Select

Trying to insert data to a table with values from different tables. INSERT INTO class_teachers_section(class_ref, teachers_ref, section_ref) select (select class.id as class_ref from class ...
2
votes
2answers
57 views

Should I drop a foreign key if I use a soft delete?

"ON UPDATE" scenario never happens in my application. As soft delete is used, "ON DELETE" cascade and restrict scenario never happen as well now. Then, should I just drop foreign key because I have ...
0
votes
0answers
28 views

Implicit conversion from data type varchar to varbinary is not allowed. Use the CONVERT function to run this query

While I am executing a query, I am getting the below error: Implicit conversion from data type varchar to varbinary is not allowed. Use the CONVERT function to run this query My query is: ...
0
votes
1answer
44 views

Is it possible to create a function in SQL server to act as clause e.g. Where or Limit

I've found a simple way to mimic the limit clause is SQL server by using SELECT * FROM customers OFFSET 22 ROWS FETCH NEXT 5 ROWS ONLY I'd like to replace those two line with LIMIT(22, 5) e.g. ...
1
vote
1answer
53 views

add a column to an existing table

I'm wanting the best way to add a column to an existing table in my database. I'm using SQL Server 2012. I don't want the data that is in the table to be affected, I just want to add a new column ...
0
votes
1answer
38 views

change column name

I'm needing to update a few column names in some tables I have in my database. I'm using SQL Server 2012. I'm aware of using the RENAME ability: ALTER TABLE table_name RENAME COLUMN old_name to ...
-1
votes
0answers
11 views

Error stored procedure Mysql

I have a table and every month need to delete data for new data are included. I made a stored procedure to automate this process. This table has about 3 million lines in a monthly period. This can ...
1
vote
1answer
69 views

Selecting data from multiple rows and insert it into a column

My table is like this: temp1 name city phone_no pincode ----------------------------------- amit Delhi 12345 123 Rajiv Bombay 836536 432 How do I transform the last ...
0
votes
2answers
48 views

Set default value for all columns with specific name within a database

I've got a database that includes an int column project_id on many tables, and I want to script setting the default value to a specific value for all columns with that name in the database. Note that ...
0
votes
1answer
27 views

How to install/enable DAX functions in SQL Server [closed]

How to install/enable DAX functions in SQL Server? I want to pivot and use some Excel functions in SQL Server
0
votes
1answer
64 views

MySQL select with left join query

I have following code. select class.name as classname, class.hours as hours, teachers.first_name as teacherFirstName, teachers.last_name as teacherLastName from teachers,class left join ...
1
vote
1answer
32 views

MS Access query-by-form opening query, but not running it with new form data

I have created a query-by-form in MS Access. The form has a text field for each field in my table. I'm only using one starting out to test. The query criteria for that field is Like "*" & ...
1
vote
1answer
17 views

How to apply a newly-created Domain to an existing Column?

In Postgres 9.4 Beta 1, I successfully created a domain of type VARCHAR, fuel_domain_. The domain checks that a value is any of 5 possible strings, coal, gas, wind, hydro, other. CREATE DOMAIN ...
2
votes
0answers
57 views

Split comma separated entries to rows

I have a Table like this: | ID | OtherID | Data +--------+-----------+--------------------------- | 5059 | 73831 | 5103,5107 | 5059 | 73941 | 5103,5104,5107 | 5059 | 73974 | ...
0
votes
1answer
24 views

move content from one table to another table and add a new value

I need to move content from one table to another table, this part is done: INSERT INTO `insc_mwc` (`nome`,`empresa_idempresa`,`cat_mwc_idcat`,`points_pontos`,`n_registo`) SELECT ...
0
votes
1answer
46 views

How to select non unique values from 1 column if a value doesn't exist in column 2

I have a table containing (among other things) 2 integer values, neither of which are unique. See below for example data: --------------- | a | b | --------------- | 1 | 1 | ...
3
votes
2answers
62 views

Pagination with PostgreSQL 9.3: counting number of pages

I'm implementing pagination and sorting of rows in, let's say, products table, using multicolumn index on category, score and id. -- index create index category_score_id on products(category, score, ...
1
vote
1answer
52 views

MYSQL Query - Unexpected result in text messaging database

On a text messaging database I have built, I am trying to return the total amount of messages a user has sent and the total number of messages a user has received. I have the following code: SELECT ...
0
votes
0answers
23 views

MySQL: Select a subset/range of a result

Assuming there's an application for running events (marathons etc.). An event (i.e. a run) has an ID and serveral segments, divided by checkpoints. So here's what we might get: SELECT * FROM segments ...
2
votes
0answers
34 views

Slow Performance of Parametrized Query in Excel due to Parameter Datatype

I'm pulling Data from a SQL Server 2008 into Excel using a Parametrized ODBC Query created by the Excel Wizard. (Data-->getExternalData/FromOtherSources-->FromDataConnectionWizard-->ODBC DSN) My ...
1
vote
3answers
67 views

check if tables has same columns

I have a Database that creates day tables and some of the tables don't have the same number of columns and in some cases the columns aren't the same. What I'm needing to do is consolidate all the ...
0
votes
0answers
52 views

Index Tuning Question

I have the following query: SELECT T1.ITEMID, T1.ITEMTYPE, T1.PURCHMODEL, T1.HEIGHT, T1.WIDTH, T1.SALESMODEL, T1.COSTGROUPID, T1.REQGROUPID, T1.EPCMANAGER, ...
0
votes
1answer
28 views

MySQL: What is SQL profiler, does it different for MySQL?

Whenever SQL profiling comes in mind, focus goes to two below sections: GUI tools like - MONyog, Neor Profile SQL set profiling =1; Execute Query; show profiles; show profile; I am really confuse ...
1
vote
1answer
43 views

Detect data spikes (loops) in MySQL database and ignore these

i must create some statistics out of a WWW access log database, but i found out that there are some redirect loops after a login if the user has disabled cookies. So there are 10-1000 mostly identical ...
0
votes
0answers
12 views

Multiple Trace Files or Replay

I am just wondering how useful the replay functionality of SQL profiler is. The issue I have is that I can capture a workload from production with little overhead, however I would not be able to ...
1
vote
1answer
78 views

MySQL: Which join is better between left outer join and inner join

Which join is better peforming if all of them provides the same result? For example, I have a two tables employees(emp_id,name, address, designation, age, sex) and work_log(emp_id,date,hours_wored). ...
0
votes
1answer
37 views

How do I select the latest rows for all users?

I have a table similar to the following: => \d table Table "public.table" Column | Type | Modifiers ...
1
vote
1answer
70 views

Efficient way to insert/update/delete table records from complex query in Postgres 9.x

I have this function which returns a set a records and I need to persist those records into a table. I have to do it hundred times a day. My initial approach was just clear data from my table and ...
1
vote
1answer
93 views

PostgreSQL 9.3 - Performance Issue: Counting table entries slower with jdbc postgres driver

I'm using PostgreSQL 9.3 and want to ask if it is possible to improve the performance of my queries based on the following database schema: CREATE TABLE "entities" ( "id" BIGSERIAL, "type" INT ...
1
vote
1answer
45 views

Combining count queries into one table row

I'm banging my head against the wall because I'm sure this is super easy. I have a few queries set up that get counts for a few related tables. This is for an arcade game tracking system. The ...
1
vote
1answer
54 views

Cannot open database “user_auth.mdf” requested by the login. The login failed. Login failed for user 'web_user'

I am trying to deploy my first VB.NET application on GODADDY. I created a SQL server database and was able to create tables using SQL Server Management Studio. I created a user web_user and was able ...
0
votes
1answer
45 views

Any way to get database data back?

So I've entered a couple hundred rows of data into a database manually and have begun implementing a Java frontend. However, I got an unexpected result and now when I go back into RazorSQL, the ...
0
votes
1answer
42 views

sql expiry date use Trigger OR Schedule a Job

I have this table : Now, i like the way when the date expires. EndTime < GETDATE() expire field is true. What method should I use? use a trigger to true or a schedule job that run before run ...
1
vote
1answer
57 views

Execution Plan in Microsoft SQL Server

I have a stored procedure in my database. As per my knowledge it's pre-compiled subroutine. Question 1: If I execute following queries from Hibernate, will database create a separate execution plan ...
0
votes
0answers
45 views

Updating +150,000 rows using .sql file causes ERROR 2013 Lost connection to MySQL server during query

I am using ubuntu 12.04. I have a .sql file that is around 5 megabytes. When I use the command: mysql -u -p -v database query.sql The server prints out the content of the file (because of --verbose) ...
2
votes
2answers
36 views

Strategy to find the unique bivariate polynomials

I have table that stores Tutte polynomials of a large set of graphs. These are bivariate polynomials with integer coefficients. An example of a polynomial taken from Wikipedia is: Since the ...
0
votes
1answer
52 views

Text Storage and Database Design Optimization in a SQL Server Database

Given a database with a number of columns (c), where some of these columns contain text that is one of multiple values due to a set CONSTRAINT on the columns, what is the most efficient way to ...
0
votes
1answer
44 views

Modify text file with Oracle PL/SQL

I'm trying to open and replace a string in a text file with the following procedure: BEGIN v_file_name := 'text_file.txt'; v_filehandle := utl_file.fopen(v_file_dir, v_file_name, 'W'); v_id_nextval ...
2
votes
1answer
70 views

Table name with special character in the end

I have a table in database(oracle sql) which somehow contains one special character at the end which I dont know.I am trying to get that special character from its entry in table tab. SQL> SELECT ...
0
votes
1answer
28 views

Distributed transaction coordinator between SQL Server and Oracle

I'm not sure about distributed transaction coordinator so please bare with me on this, I'm probably asking this question wrong. I know distributed transaction coordinator is used in SQL Server and can ...
0
votes
0answers
28 views

Sql Server Agent Job

In my Local SQL Server 2008 I created a scheduled job (like daily email will send to particular user from the database based on condition). Now I decided to host my schedules in hosting server so can ...
1
vote
3answers
101 views

How to separate Stored Procedures (i.e. all the business logic) from Client Database so that it only contains client data?

Scenario: Our Application Database (in SQL Server 2012) contains entire business logic in the Stored Procedures (SPs). Everytime we have to publish the DB to the client, it unnecessarily results in ...
1
vote
2answers
42 views

Query for frequency of e-mail addresses in a field

Newbie here. I know the answer is out there, but lack the vocabulary to ask the right question... I am looking for a MYSQL query which gives me the frequency of addresses in the field emailaddress. ...
0
votes
2answers
115 views

How to create an oracle dump(.dmp) file using Toad?

We can export the entire database schema(skeleton) along with its data in one .dmp file using oracles "exp" tool. But how do I do it using Toad only. I can't use this C:\Users\kaunds_oliver>exp ...