sql

incremental SQL query

My application has a fixed set of SQL queries. These queries are run in polling mode, ever 10 seconds. Because of the size of the database (> 100 GB), and the design (uber normalized), I am running into performance issues. Is it possible to get incremental changes to a given query, whenever a CRUD event happens on the DB that changes t...

Only SQL Server configuration tools got installed. What's the problem ?

I installed SQL Server 2005 Express edition on my system. I am using Windows 7 (64 Bit) OS. While installing it said compatibility issues. Though, it got installed and showed successfully installed. But, only the configuration tools were installed. Also, how to create a database or how can I use it. Thanks Vinaychalluru ...

SQL Query that relies on COUNT from another table? - SQLAlchemy

I need a query that can return the records from table A that have greater than COUNT records in table B. The query needs to be able to go in line with other filters that might be applied on table A. Example case study: I have a person and appointments table. I am looking for all people who have been in for 5 or more appointments. It mu...

Update and select in one query

I found similar questions with correct answers. But they're a bit complicated for me. I just want a simple basic statement. I have: string sql = "UPDATE tblPopUp SET PopUp = 'False' WHERE DisplayNo = 1" ...and: string sql1 = "SELECT Period FROM tblPopUp WHERE Dis...

How do you match multiple column in a table with SQLite FTS3?

Lets say I have a table with columns A , B , C , D and I want to do a match on column A and C I see that you can either match a single column or all column in sqlite ie - match column A select * from table where A match 'cat' - match all columns select * from table where table match 'cat' Is it possible to match only columns A and ...

Copy data from one existing row to another

I have one table for storing status and comment.Some more columns are there.Now each time one new comment is posted I need to insert one new row in that table(change is only in the comment field , status and all other column values will remain as it is).What's the best way of doing this? ...

Is it possible to have nulls in Foreign keys in any ANSI SQL database?

Is it possible to have nulls in Foreign keys in any ANSI SQL database? ...

SQL Server Primary file group max size

Hello All!!! I have a situation, I am trying to run almost 100 update statement on a table say 'XX' In SQL Server database. But it is giving me an error tat goes something like this... "Could not allocate space for object 'dbo.XX'.'PK_XX_3489AE06' in database 'MYDATABASE' because the 'PRIMARY' filegroup is full. Create d...

searching different value in one column

i have a transaction table like this cust_id | item --------------------- 1 | book 1 | shoe 2 | book 3 | shoe how can i use SQL command to find customer who bought book and shoe together? so, the result can be only customer 1. I need to do Apriori project, iv try to google, but i dunno the correct phrase to be...

MySQL data types: int versus enum

I have a number of columns that only need to store a few values (e.g. 0, 1, 2, 3). What datatype should I pick for such a case? I feel like I should pick something like ENUM('0', '1', '2'). Would int be better (despite it being less restrictive)? Should I consider something else (like tinyint)? EDIT: Actually, what general advice shoul...

Need to select from multiple tables based upon records in one table

Hi guys, heres the situation. I have a table called as maps coordinates the schema is like below: map_coordinates: item | item_id | latitude | longitude The idea is that this table contains a list of coordinates of different items, they could be a note, a classifieds post, an event etc. I want to be able to set it up so I have a resul...

Convert .trc TO Pdf/.Doc

i wanna convert .trc files(sql trace files) to PDF or .Doc format , is there any convertor which can accomplish the job? ...

Linq to SQL Sum()

select sum(Sales) from WeeklyProductSale. how i can write this query in linq and what this query will return to me. thankas in advance. ...

MySQL - Getting information from bus routes database

Hi, The problem I'm having is with fetching data from the following tables where a bus route contains 1 change or more. I am still relatively new to SQL. I have a database containing 2 tables (bus_route and bus_stop). bus_route contains the following columns: route - the number of the bus run - the direction of the bus (1 or 2) sequen...

Informix JDBC PreparedStatement UPDATE Multiset

I want to change MULTISET column of the table, and my code looks something like this: PreparedStatement pstm = preparedStatement("UPDATE table SET mc = MULTISET{?, ?} WHERE ..."); pstm.setString(1, "..."); pstm.setString(2, "..."); pstm.execute(); And I get error: "Illegal attempt to convert a collection type into another type.". Wha...

AdvantureWorks Hirarchy

Hi everybody. I have a question about AdvantureWorks. What is the query to determine the full hirarchy of an employee's managers? example: Alex is the input Sara (Manager - Level 1) James(Manager - Level 2) David(Manager - Level 3) Alex(Simple Employee) ...

How can you run a mysqli query with CodeIgniter?

Hello guys, Does anyone have a clue how to run a mysqli query with CI. I did change the db driver in the config file, but I'm still unable to use multiple queries like $sql = "SELECT * FROM c WHERE 1; DROP TABLE IF EXISTS c;" $query = $this->db->query($sql); Anyone has any clue how to do this using only CI, no additional libr...

How to save and retrieve .NET List<byte> to SQL database using WCF services?

In my C# project I save and retrieve lots of data to and from an SQL database using wcf services / linq to sql. I stumbled upon a need to save a list of and which are pixel values of images. The pix values are later used for references to their brightness in web applications. I don't want to save the entire image in the db, but only...

insert or update confusion

Hi everyone, I'm a bit confused about how to handle the situation where you update a row in sqlite if it exists, or insert it if it doesn't. I seem to see a different solution on every answer there is to this problem. Whats the most efficient or easiest way? EDIT: I meant sqlite, sorry ...

Conditional Count of Related Records

I'm sure there must be a simple way to do this, but I've been tearing my hair out for hours now and I'm getting nowhere. Here is a working query from a customer listing utility: SELECT c.customer_ID, title, surname, forenames, COUNT(booking_ID) AS bookings FROM customer c LEFT JOIN booking b ON c.customer_ID = b.customer_ID WHERE cust...