Skip to content

Tag: sql

Auto increment function, Oracle PL/SQL

I have a number of triggers which do various things, but at the top of all of those which have unique integer primary keys, I need them to auto increment. The code currently looks as follows: I thought it may be useful to make a small function for this, as I would if this were a conventional programming langu…

Query Totaling Multiple columns and grouping by another

I am trying to get some totals of multiple records based on Location – but get totals for multiple columns to present back – basically there are various locations and each location has different species and totals at that location. Without doing something really ugly – I have no idea of the …

JPA with HIBERNATE insert very slow

I am trying to insert some data to SQL Server 2008 R2 by using JAP and HIBERNATE. Everything “works” except for that it’s very slow. To insert 20000 rows, it takes about 45 seconds, while a C# script takes about less than 1 second. Any veteran in this domain can offer some helps? I would app…

SQL Insert Query Using C#

I’m having an issue at the moment which I am trying to fix. I just tried to access a database and insert some values with the help of C# The things I tried (worked) A new line was inserted and everything worked fine, now I tried to insert a row using variables: Didn’t work, no values were inserted…

MySQL Query selection

I have a big database table called pricing. The fields are following: id code description rrp buy stock date distributor vendor version User select the vendor field only. version field can be vary …

SQL Find duplicate sets

given this Schema: table tblSET SetID int PK SetName nvarchar(100) Table tblSetItem SetID int PK ItemID int PK tblSetItem.SetID is a FK into the tblSet Table. Some data: …

Performing an UPDATE with Union in SQL

If I were to have these three tables (just an example in order to learn UNION, these are not real tables): Tables with their columns: And I wanted to update order_status in the Customer table when there is a order filled in either the Order_Web table or the Order table for that customer using Union: How can I…