sql

Parsing a string into an table using oracle SQL

Hi, guys. Say I have the following table: ID | String ---+--------- 1 | <123><345> 2 | <1-2><45-67> 3 | <345-321><234> This is a legacy data format in my app which is currently impossible to avoid. What I need to acheive, is: ID | String ---+--------- 1 | <123> 1 | <345> 2 | <1-2> 2 | <45-67> 3 | <345-321> 3 ...

MySQL query running really slow for large database

I am trying to extract duplicate rows from my database. I have a listings table and a listings_meta table which holds additional information. The listings_meta table has over 16,000 rows. When I run the query below it runs REALLY slow. I don't understand why. Is there something wrong with my code? SELECT l.id FROM listings AS l LEF...

linq to XML as a gridview datasource

I'm trying to get all the email nodes for the customers in the sample xml and binding it to a grid. I can't seemt to get past the linq query! Sample XML: <group> <customer> <email>[email protected]></email> </customer> <customer> <email>[email protected]</email> </customer> </group> var query = from result in xml.Elements("custo...

Create a new Column in database from data in existing column.

I have a table TableName: MACAddresses Columns: - Computer - MACAddress I would like to create a sql script that creates a new column and correctly formats the mac address with the colon (ie with Substring) - To create a new column called CorrectMAC How would I do this with Oracle? ...

Analysis Services for SQL Server 2008 R2 Express

Is it really to add Analysys Services for existing instance of SQL Server 2008 R2 Express? ...

Performance in SQL key indicators to check

Hi, I am pretty new at MS SQL. I would like to know a starting point list of parameter to look in EXECUTION PLAN as indicator for good or bad performance in mu query. For example: Should I look for Estimated subtree cost for better performance? Any other values to look? thanks guys for your support ...

SQL search, search for a|b|c|d in a table and return results ordered by number of elements in the record

the question: there are two tables - DAYS(name), ACTIONS(day_name,name) records for DAYS are: Sunday, Monday, Wednesday records for ACTIONS are: {eat,sunday}, {sleep,sunday}, {write,sunday}, {drink,sunday} {eat,wednesday}, {sleep,wednesday}, {write,wednesday}, {eat,monday}, {sleep,monday}, i want to search in ACTIONS for the day...

postgresql query to show the groups of a user

Hello, If I create a user in a group, like: create role user_1 login inherit in role group_1; later, with which query could I retrieve to which group(s) a user belongs to ? Thanks ! ...

Differences between two dates in Oracle which were in same column

I have a table MyTable with columns: ID number (autoincrement) STAT number(3) (status: 1-start, 2-stop) USER varchar2(15) (user name) DATE date (date) with data: ID STAT USER DATE --------------------------------------- 1 1 USER1 18.08.2010 13:10:14 2 2 USER1 18.08.2010 15:15:40 3 1 USER1 1...

Static vs dynamic sql

In my database at several places developers have used dynamic sql instead of static. And they are saying reason for this is to improve the performance. Can someone tell me can if dynamic sql can really increase the performance in stored procedure or plsql block? Which will execute faster and why ? 1. begin execute immediate ...

MySQL Query: Select an int field multiple times based on range the numbers fall into

I have an int field in my table scores. It can be a number between 0 and 100. There are over a 1000 rows in that table. I want to select the number of rows that fall between ranges 0-25, 26-50, 51-75 and 76-100. So basically, if this is my scores table score (int) ------------ 10 20 12 56 43 90 87 The output of the query shoul...

Cast uniqueidentifier to binary

Hi. how can i Cast uniqueidentifier to binary in Sql? Thanks. ...

Loading behaviour of EF v1?

Hello, another Entity Framework (ADO.NET) question from me. I'm using EF1 (no choice there) and have a MySQL database as a backend. A simple question I can't really find a satisfying answer for: What exactly do I have to do for loading? IE., when I have an entity and want to enumerate through its children, say I have the Entity "Group"...

Evaluating an expression stored as a string

I want to store a boolean expression in a database, and evaluate it. It’s not necessary to store the complete expression tree, a string probably do it. I imagined a scheme like this: Criteria (expression_to_evaluate, value_to_return) For example, let’s say that I have an expression that matches people with age between 20 and 40: (var ...

SQL to retrieve tree structure nicely

Given the simple data structure: ID | Category_Name | Parent_ID Example: 1 Cars 0 2 Boxes 0 3 Lamborghinis 1 4 VW Camper Vans 1 5 Big Boxes 2 6 Small Boxes 2 7 Cereal Boxes ...

(my)SQL: Select 20 latest entries in logfile from unique persons

hi, I have a logfile which logs the insert/delete/updates from all kinds of tables. I would like to get an overview of for example the last 20 people which records where updated, ordered by the last update datetime DESC What I have now is: SELECT DISTINCT logfile.idvalue, DATE_FORMAT(logfile.logDateTime,'%d-%m-%Y %H:%i') AS thedateti...

Effectively (in terms of performance) store and use set values in MySQL

I need to store set value in MySQL column. I completely like the build-in SET type, but it seems that FIND_IN_SET() function requires table scan which is bad. It seems that SET uses binary values under the hood. If I use binary value to represent a set, for example for a set of four elements it could be something like this: 0100 0101 0...

Newbie question on Hibernate... in context of Martin Fowler article.

Hi, In Domain Logic and SQL, Martin Fowler talks about 3 styles of interfacing with a database: Transaction Script Domain Model, and Logic in SQL What I'd like to know is: When employing Hibernate for persistence, which of the above 3 styles is typically used and/or encouraged? Is there any 4th style when using Hibernate? (In co...

SQL Query Time Coverage

I don´t now if this is the right place for such a question, but I´ll try it :) I have got several sql db entries which represents time periods E.G. Datefrom datetill 2010-10-01 2011-01-01 2011-02-01 2011-05-16 2011-08-08 2011-09-01 I need to test if a given time period ist fully covered from the entries. Is th...

SQLite - SELECT query returning more than expected

Hi, In the following my SQLite database has 10 values in each table. However, when performing my query there are around 100 results returned. SELECT videoformat, audioformat FROM videocodec, audiocodec Any ideas with why it is doing this? Thanks ...