sql

how can i able to delete the n'th ROW in a table using mysql query

Hi, Is there any way to delete the n'th ROW of a table using MYSQL Thanks in Advance Fero ...

What can cause a materialized view in Oracle 10g to stop fast refreshing?

If I have materialized view in Oracle which is defined as REFRESH FAST ON COMMIT every 15 minutes. It works when initially created and refreshes happily. What can cause it to stop fast refreshing? I can see that it has stopped refreshing based on this: select mview_name, last_refresh_date from all_mviews; ...

Why are parameters slower than literal values in a where clause?

Situation: c#, sql 2000 I have a table, lets call it 'mytable' with 30 million rows. The primary key is made up of fields A and B: A char(16) B smallint(2) When i do a search like this, it runs really slowly (eg it does a full tablescan) string a="a"; int b=1; string sql = "select * from table(nolock) where a=@a and b=@b"; using (Sq...

Subscriptions etc with SSRS and SQL Server 2005 Work Group edition

Does anyone have any suggestions about how to schedule the creation of reports and how to allow users to view them in a SQL Server 2005 Work Group environment where scheduling and subscriptions do not appear to be supported. SQL Server is installed on a separate machine to that running IIS to support multiple production websites. ...

Sql Parser With Engine

Hi, I need parser on java that parse SQL and return it as some structure. This structure must have some binding point to what I can bind low level reader. ...

SQL Comparing 2 tables with a link table

Hi there, I'm going to get some real-world data the best I can for this query I'm having a hard time with. Table HierarchySet: HierarchySetId ClientId 22 1866 23 1866 Table User: UserId UserName ClientId 76 TestUser 1866 Table LinkTable: LinkId UserId OrganisationId Hierar...

SimpleDB as Denormalized DB

In an environment where you have a relational database which handles all business transactions is it a good idea to utilise SimpleDB for all data queries to have faster and more lightweight search? So the master data storage would be a relational DB which is "replicated"/"transformed" into SimpleDB to provide very fast read only queries...

Conversion of INTEGER to DATETIME differs to VB6

I'm looking at some legacy VB6 code (years+years old, before my time) which runs a query against an SQL 2005 db. It supplies a date restriction in the WHERE clause - where the date is given as an integer value as a result of a CLng() on the Date in VB6. e.g. ... WHERE SomeDateField >= 40064 40064 is what VB6 converts today's date to ...

How does row design influence MySQL performance?

I got an users table and some forum, where users can write. Every action on forum uses users table. User can have a profile, which can be quite big (50KB). If I got such big data in each row wouldn't it be faster to have separate table with user's profiles and other data that aren't accessed very often? In an online RPG game each charac...

How can I view SQL Generated by Visual Studio DataSource?

I've got a data source in Visual Studio. Is there any way to view the SQL that it generates before it sends it to the database? I don't just want to see the SelectComand, InsertCommand properties which are part of the asp:SqlDataSource, I want to see the query once the parameters have been filled. Is it possible to do this from Visual St...

SQL massive performance difference using SELECT TOP x even when x is much higher than selected rows

Hi All, I'm selecting some rows from a table valued function but have found an inexplicable massive performance difference by putting SELECT TOP in the query. SELECT col1, col2, col3 etc FROM dbo.some_table_function WHERE col1 = @parameter is taking upwards of 5 or 6 mins to complete. However SELECT TOP 6000 col1, col2, col3...

SQL Mass Reordering of rows

Hi, I have a table with a list of records, and a column called order. I have an AJAX script to drag and drop the table rows up or down which I want to use to perform a query, reordering the rows as they have been dragged. In the PHP, I perform a query to get the current order of the records. eg 1, 2, 3 ,4 The AJAX function passes the ...

JPQL and SQL Criteria Api

JPA 1.0 specification is not defining the Criteria API which provides a programmatic approach for creating and modifying JPA Queries. Is there any API for building SQL and JPQL Queries like the way Hibernate Criteria Api is doing? ...

count number of rows that occur for each date in column date range.

I have a table with data such as below Group Start Date End Date A 01/01/01 01/03/01 A 01/01/01 01/02/01 A 01/03/01 01/04/01 B 01/01/01 01/01/01 ETC I am looking to produce a view that gives a count for each day, like this Group Date Count A 01/01/01 2 A 01/02/01 2 A 01/03/01 ...

Oracle Performance IN or OR

Which operator in oracle gives better performance IN or OR ex: select * from table where y in (1,2,3) or select * from table where y = 1 or y = 2 or y = 3 ...

Simple SQL question about getting rows and associated counts

Hi guys, this oughta be an easy one. My question is very similar to this one; basically, I've got a table of posts, a table of comments with a foreign key for the post_id, and a table of votes with a foreign key for the post id. I'd like to do a single query and get back a result set containing one row per post, along with the count o...

How do i check all Queries for Binding errors

Hello! I'm in the process to migrate a datebase. New is that a part of the data's home is in an external database (ERP-System). I have to modify a large number of queries. How can i check all queries & SP's, if they still run successfuly? If i have a query 'A' which depends on query 'B', and i change a column in query 'B' i do not get...

Selecting one row from duplicated rows

I have a loooooong stored procedure that runs about 15 select statements across different tables in a database - I am inserting all the results of the selects into a temporary table. However - that table has some rows that are exact duplicates. The temporary table looks something like this: DocID | VisitDate | DocName 824...

SQL query for selecting products with same ingredients of other products

I have a database that stores products "available on the market" and products "still in development" in two separate tables (market_product and dev_product). A third table (substance) contains all substances a product can made of. Other two tables (marked_product_comp and dev_product_comp) mantains product compositions. I want to selec...

Getting an average from subquery values or another aggregate function in SQL Server

I have the SQL statement (SQL Server ) SELECT COUNT(ActionName) AS pageCount FROM tbl_22_Benchmark WHERE DATEPART(dw,CreationDate)>1 AND DATEPART(dw,CreationDate)<7 GROUP BY dateadd(dd,0, datediff(dd,0,CreationDate)) which produces the output pageCount 27 19 59 Now I would like to get the average of all those figures using SQ...