sql

ORA-27101: shared memory realm does not exist

i am facing this error when i start the oracle. I checked Oracle Home and SID. everything is set properly. ORA-27101: shared memory realm does not exist please help me to find out the solution. Thanks in advance ...

ASP.NET GridView Pagination using MySQL LIMIT

I have a GridView which I bind at runtime to a dataset via a query. I handle the pagination using the PageIndexChanging and PageIndexChanged events to set the GridView's PageIndex property on postback from the pager. While this functions correctly, the problem is the performance with >7800 rows in this table. It has to return the entire ...

SQL JOIN and LEFT JOIN the same table with differents conditions

I need to JOIN a table when certain conditions are met and LEFT JOIN it when other conditions are met. Since I am in a MS Dynamic CRM with filters, I can't use UNION SELECT stuff.stuffs FROM MainTable JOINS othertable LEFT JOIN othertables LEFT JOIN TableX as X1 ON (Conditions1.1 = X1.1 AND MainTable....

Newbie: Import data from certain cells in Excel to SQL?

Hi, I am new to importing data into SQL Server tables - I have only used the Import/Export Wizard in MS SQL Server 2008 so far. However, I have a need to import hundreds of Excel files that are formatted exactly the same, but the data is in different cells/rows/columns in the workbook. There is no header row. I am wondering if there ...

Merging two complex queries.

What I ended up doing was taking two SQL queries and using the array_intersect() in PHP to filter out the results: $sql1 = 'SELECT z.*, u.username, u.user_colour, u.username_clean, u.user_avatar, u.user_avatar_type FROM ' . ZEBRA_TABLE . ' z, ' . USERS_TABLE . ' u WHERE (( z.user_id = ' . $user->data['user_id'] . ' AND z...

t-sql combine column values

Based on the following table ID Description ReleateID ----------------------------------- 1 some desc1. 50 1 some desc1. 60 2 some desc2. 50 2 some desc2. 70 3 some desc3. 80 How to get the following output ID Description AllRelatedIDs ---------------------------------- 1 some desc1. 50,60 2 some desc2...

Can I set the isolation level in the connection string?

How can I set the isolation level of all my SqlCommand ExecuteNonQuery calls to be read uncommitted? (connecting to a SQL Server 2008 enterprise instance) I am simply transforming static data and inserting the results to my own tables on a regular basis, and would like to avoid writing more code than necessary. ...

MySQL: Name primary key in CREATE TABLE statement

How do I set the name of a primary key when creating a table? For example here I'm trying to create a primary key with the name 'id', but this is invalid SQL. Can you tell me the correct way to do this? CREATE TABLE IF NOT EXISTS `default_test` ( `default_test`.`id` SMALLINT NOT NULL AUTO_INCREMENT PRIMARY KEY `id`, `default_te...

SQLite and custom order by

I have a table with categories: ID Category "1","Baking" "3","Family" "4","Entertaining" "5","Children" "6","Desserts" Now I would like to order the result of the select statement to ID Category "4","Entertaining" "3","Family" "1","Baking" "5","Children" "6","Desserts" for example. In MySQL, you'd do ...

Is this the optimum query for what I'm trying to do in MySQL?

I'm running a number of queries that merge constantly-changing data into a master table and one of the queries (below) seems to be running quite slowly. The set up is as follows: products table and products_temp table have identical structures. New data goes into the products_temp table, then I run queries similar to the one below to me...

Rails - escaping SQL params

I am doing some plain SQLs in my rails model (for purists this is just for complex SQLs :) Since I am not using find*/condition methods, is there a helper method that I can use straight to do that? ...

Is this a bad approach to database design?

I have to build an application for my university that will count as course credit for a Class that lasts 1 month. In this application I have to have a way for users to save a Teacher Class Followup Evaluation, which is a person goes to the classroom and checks out the teacher and ticks certain columns. An example would be: Pedagogical ...

ASP.NET ApplicationId

Hi, I've read somewhere that ApplicationID is a unique id for a website (iis site path). But I'm still confused. Here are my questions.. When and why do I need this? I'm trying to implement asp.net membership for a website and I'll create some additional SQL tables (such as Companies, Services, etc) other than asp.net membership tables...

When deleting a record that is referenced in another table, how do I know when to stop?

I have the following table structure in my database: create table Encargado( ID int primary key, Nombre varchar(300), ) create table Area( ID int primary key, Nombre varchar(300), Jefe int foreign key references Encargado(ID) ) create table Carrera( ID int primary key, Nombre varchar(300), Area int foreign key references Area(ID) ) c...

how to combine the result of one Mysql (sub)query that returns multiple rows and use that for another query

I have two tables, one that stores serial number uut_build, and another for measurements that belong to the serial numbers measure_list, I'm trying to get the count of records in measure_list that belongs to a unique serial number. Query #1 select id, uut_sn from uut_build where uut_sn like 'A%'; Query #2 select count(*) from measur...

Transforming Table into different Table

I have a table like this: RowID | ProductDescription1 ----------------------------------------------------- 1 | 0296620300-0296620399; 2 | 0296620400-0296620499;0296620500-0296620599; 3 | 0296620600-0296620699;0296620700-0296620799; I want to become like this: NewRowID | Start | End | SourceRowID ------------...

WCF Service: ASP.NET Cache or SQL

I'm currently developing a WCF REST Web Service that will be running on Microsoft Azure. To limit the number of requests per IP address to prevent abuse, I currently store the IP and timeout using the ASP.NET Cache. This method works great but since muliple VM instances with Azure don't share a single cache, the requests could be split ...

SQL Server: SQL queries compared to general programming

I'm just starting out with SQL Server 2008 Express and spent the last hour or so trying out some basic queries. How does SQL scripting (correct term?) compare to general computer programming? Is writing SQL queries as involved, lengthy to learn, needs as much practice, etc. as software development? Is writing advanced SQL queries compara...

COUNT and GROUP BY on text fields seems slow

I'm building a MySQL database which contains entries about special substrings of DNA in species of yeast. My table looks like this: +--------------+---------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------------+---------+------+-----+---------+-------+ | species | text | YES ...

Postgres, table1 left join table2 with only 1 row per ID in table1

Ok, so the title is a bit convoluted. This is basically a greatest-n-per-group type problem, but I can't for the life of me figure it out. I have a table, user_stats: ------------------+---------+--------------------------------------------------------- id | bigint | not null default nextval('user_stats_id_seq'::regcla...