I'm storing recurring events in an events table that take place during certain months of the year, any year and every year. For instance;
CREATE TABLE events (
event_id tinyint(3) unsigned NOT NULL auto_increment,
name varchar(255) NOT NULL,
month_from tinyint(3) unsigned NOT NULL,
month_to tinyint(3) unsigned NOT NULL,
P...
I have a couple large tables (188m and 144m rows) I need to populate from views, but each view contains a few hundred million rows (pulling together pseudo-dimensionally modelled data into a flat form). The keys on each table are over 50 composite bytes of columns. If the data was in tables, I could always think about using sp_rename t...
Hello!
I want to store a value that represents a percent in SQL server, what data type should be the prefered one?
...
I need to determine file type (i.e., MimeType) of stored data in the SQL Server 2008.
Is there anyway, if possible using SQL query, to identify the content type or MimeType of the binary data stored in the image column?
...
I have your run of the mill nested set hierarchy type setup with the following columns:
table name:
myset
columns:
id, name, lft, rgt
Does anyone know a query to determine the parent of a node?
I read a couple places that it's handy to also have a *parent_id* column in your table to keep track of this, but it seems redundant and ...
I've got a table recording views of programs. Each program can have two different types (1=video, 2=audio)
My table to record the views:
TABLE views
view_id
user_agent
created_at
type
program_id (which related to table programs)
My current MySQL call:
SELECT COUNT(*) as views,
`mp`.`title`,
`mp`.`program_date` as da...
I am getting a "SQL Server Error: arithmetic exception, numeric overflow, or string truncation" error
here is the code below
AQuery:= TSQLQuery.Create(nil);
with AQuery do
begin
SQLConnection:- AConnection;
SQL.Text:= 'Insert into.....';
ParamByName('...').asString:= 'PCT';
.
.
.
try
ExecSQL;
finally
AQuery.Free;
end;
end;...
Hello all,
Here is an example of some TSQL that I would like to rewrite in PL/SQL.
DECLARE @xml XML
SET @xml = '<theRange>
<theRow><First>Bob</First><Last>Smith</Last><Age>30</Age></theRow>
<theRow><First>Sue</First><Last>Jones</Last><Age>34</Age></theRow>
<theRow><First>John</First><Last>Bates</Last><Age>40</Age></theRo...
I am joining a few tables for a selection
If there isnt anything matching in the 2nd, 3rd, 4th tables I still want to pull the results as long as the first table has a match. I thought LEFT JOIN did this, but it is not.
Here is the full query:
SELECT cart_product.*, prod_drop_products.prod_drop_product_name, everlon_sheet.*, cart_prod...
I'm looking to be able to run a single query on a remote server in a scripted task.
For example, intuitively, I would imagine it would go something like:
mysql -uroot -p -hslavedb.mydomain.com mydb_production "select * from users;"
...
Hi, Im evaluating liquibase for a project starting today.
Has anybody used it to create procedures, functions, basically all of the plsql stuff?
If not, is it possible to write embedded sql code in the xml files?
Thanks in advance.
...
Hi,
I have data that looks like this:
CUSTOMER_ID OPERDAYSJUL OPERDAYSAUG OPERDAYSSEP ... OPERDAYSJUN
1 30 15 2
2 5 1 0
3 6 0 12
4 12 5 23
For each customer_id, I want a comma-delimited list indicating w...
Hi,
I have created an index on my table like this:
CREATE INDEX index_typ_poplatky
ON Auta (typ DESC, poplatok_denny DESC, poplatok_km DESC);
How to I check that the index file exists?
...
Hello. I'm a novice when it comes to SQL and PHP, and I'm trying to round an average price result and take off the extra zeroes that currently appear.
Currently my result turns up as: $3.005000
My code currently reads as follows:
$result = mysql_query("SELECT AVG(price) FROM milk WHERE price > 0 ");
$row = mysql_fetch_row ($result);
...
Please excuse me if this has been asked before (I did not find the question if it has)
But what is faster in SQL Server 2005/2008, a Stored Procedure or a View ?
EDIT:
As many of you pointed out, I am being too vague. Let me attempt to be a little more specific.
I wanted to know the performance difference for a particular query in a V...
I know there are a number of "How do I find the most recent record" questions out there, but none of them quite solved my particular problem: in MySQL, I'm trying to find the most recent record for an entry that's mapped to two different categories in the same table. There's essentially an ENTRIES table with a bunch of info, a CATEGORIES...
Hi,
I've been thinking of implementing this system, but can't help but feel there's a catch somewhere. One of the points of using GUID over incrementing int is that, in the future, if you were to merge databases together, you wouldn't have any clashes over the primary key/identifier. However, my approach is to set the increment size t...
So I have a database table in MySQL that has a column containing a string. Given a target string, I want to find all the rows that have a substring contained in the target, ie all the rows for which the target string is a superstring for the column. At the moment I'm using a query along the lines of:
SELECT * FROM table WHERE 'my supe...
Hey all, I'm having a difficult time wording this properly which is why im having trouble finding an answer online, so the best I can do is give an example. I have the following database table:
ACTORNAME SERIESNAME
------------------------------ ------------
baldwin found
baldwin ...
I have two tables, "name" and "address". I would like to list the last_name and joined address.street_address of all last_name in table "name" that occur more than once in table "name".
The two tables are joined on the column "name_id".
The desired output would appear like so:
213 | smith | 123 bluebird |
14 | smith | 456 first ave...