Here is some example data in a mysql table
a b distance
15 44 250
94 31 250
30 41 250
6 1 250
95 18 250
72 84 500
14 23 500
55 24 500
95 8 500
59 25 500
40 73 500
65 85 500
32 50 500
31 39 500
22 25 500
37 11 750
98 39 750
15 57 750
9 22 750
14 44 750
69 22 750
62 50 750
89 35 750
67...
I've always been interested in how you can throw some SQL at at database, and it nearly instantaneously returns your results in an orderly manner without thinking about it as anything other than a black box.
What is really going on?
I'm pretty sure it has something to do with how values are laid out regularly in memory, similar to an a...
Greetings
I stumbled onto a problem today that seems sort of impossible to me, but its happening...I'm calling some database code in c# that looks something like this:
using(var tran = MyDataLayer.Transaction())
{
MyDataLayer.ExecSproc(new SprocTheFirst(arg1, arg2));
MyDataLayer.CallSomethingThatEventuallyDoesLinqToSql(arg1, argEtc);...
I am not sure how to best describe what I am trying to do (or search for it for that matter) but I am going to try.
I have a pre-existing query (stored procedure) that returns items based on 3 specific ID's. What I want to do is to be able to reduce the results even further based upon a column within the results having the exact same st...
A SELECT without a FROM clause gets us a multiple columns without querying a table:
SELECT 17+23, REPLACE('bannanna', 'nn', 'n'), RAND(), CURRENT_TIMESTAMP;
How can we write a query that results in multiple rows without referring to a table? Basically, abuse SELECT to turn it into a data definition statement. The result could have a ...
I'm using Computed Columns to provide me with the following information:
Hours, Minutes, and Seconds between a Start DateTime and Finish DateTime (Where Minutes and Seconds are between 0 and 59 and Hours can be any value 0 or greater)
Computed Column for Seconds:
datediff(second,[Start],[Finish]) % 60
Computed Column for Minutes:
f...
Consider a table,
Id columnA
1 a
2 b
3 c
Select ColumnA from table gives the result as below,
columnA
a
b
c
Is it possible to get
ColumnA
a,b,c
...
I have a table like this :
Name Mar1 Mar2 Mar3 Total
xxx 80 80 80 240
yyy 60 70 50 180
aaa 85 65 75 225
I wanted to find the rank of the student based on total. I using SQL Compact 3.5 . As we have rank() function in sql server do we have something with which we can find the students rank??? When I used "sele...
I have an SQL query which returns a set of data (around 40-50 tuples).
I would like to display the results 5 at a time on an HTML page using PHP.
I already managed to have the right SELECT statement, but i am having problems to display the results 5 by 5 using a "more" button.
Can you please help?
Note that every time i call the query,...
I'm trying to write a very simple cms (for learning purposes) in kohana 3 web framework.
I have my db schemas and i want to map it to ORM but i have problems with relations.
Schemas:articles and categories
One article has one category. One category might has many articles of course.
I think it is has_one relationship in article table....
ALTER PROCEDURE GetProducts
@CategoryID INT
AS
SELECT COUNT(tblReview.GroupID) AS ReviewCount,
COUNT(tblComment.GroupID) AS CommentCount,
Product.GroupID,
MAX(Product.ProductID) AS ProductID,
AVG(Product.Price) AS Price,
MAX (Product.Year) AS Year,
MAX (Product.Name) AS Name,
AV...
I have a LINQ query that searches for multiple keywords on multiple columns. The intention is that the user can search for multiple keywords and it will search for the keywords on every property in my Media entity. Here is a simplified example:
var result = repository.GetAll<Media>().Where(x =>
x.Title.Contains("Apples") || x.Descri...
I have a project on going for a TV guide, called mytvguide in the database - I use PHPMyAdmin. This is the structure for one table, which is called tvshow1:
Field Type
channel varchar(255)
date date No
airdate time No
expiration time No ...
I am new to the concept of Pipeline Functions. I have some questions regarding
From Database point of view:
What actually is Pipeline function ?
What is the advantage of using Pipeline Function ?
What challenges are solved using Pipeline Function ?
Are the any optimization advantages of using Pipeline Function ?
Thanks.
...
In my SQL statement I use wildcards. But when I try to select something, it never select something. While when I execute the query in Microsoft SQL Server Management Studio, it works fine.
What am I doing wrong?
Click handler
protected void btnTitelAuteur_Click(object sender, EventArgs e)
{
cvalTitelAuteur.Enabled = true;
cvalT...
I have a single crystal report that usually ends up about 150 pages long. The single .rpt, through the use of clever grouping, actually includes records with little individual header and footer sections for each customer. Think of it as a sales report for 100 customers, each with their own section.
Each customer section is 2 to 7 pages ...
Hi
I don't know how I can return all attributes with the RETURNING clause
I want something like this:
DECLARE
v_user USER%ROWTYPE
BEGIN
INSERT INTO User
VALUES (1,'Bill','QWERTY')
RETURNING * INTO v_user;
END;
RETURNING * INTO gets an error , how can I replace * ?
Have you any idea ?
Thanks for yo...
Square brackets allow you to use names for columns or aliases that contain characters not permitted for column names or aliases.
a) I’ve noticed that lots of times table and column names are enclosed inside square brackets, even though their names consist of perfectly legal characters. Why is that?
b) As far as I know, square brackets...
i see after installing the asp.net membership tables, they use the data type "uniqueidentifier" for all of the primary key fields.
I have been using "int" data type and doing increment by one on inserts and declaring the column as IDENTITY.
Is there any particular benefits to using the uniqueIdentifier data type compared to my current ...
What is a candidate row when talking about Oracle and SQL? Using it in a sentence would be as such:
"The candidate row is fetched from the table specified in the outer query."
...