Hi,
I would do something like this:
select * from cars_table where body not equal to null.
select * from cars_table where values not equal to null And id = "3"
I know the syntax for 'not equal' is <>, but I get an empty results.
For the second part, I want to get a result set where it only returns the columns that have a value. So,...
In my database we have fields where the data is not readable. I now know why it happened but I don't know how to fix it.
I found a way to get the info back from the database:
SELECT id,
name
FROM projects
WHERE LENGTH(name) != CHAR_LENGTH(name);
One of the rows returned shows:
id | name
-------------------------
1008 |...
I am creating a database that will help keep track of which employees have been on a certain training course. I would like to get some guidance on the best way to design the database.
Specifically, each employee must attend the training course each year and my database needs to keep a history of all the dates on which they have attend ...
Hello,
I am having trouble getting sqlite3 to do comparisons between datetimes. On my mac, when I run the sql queries, it works. However, on the iPhone, the exact same query fails.
I have a sqlite3 table setup as follows:
CREATE TABLE IF NOT EXISTS `Artists` (
`id` int(11) NOT NULL PRIMARY KEY,
`name` varchar(256) NOT NULL,
`lastUp...
Can anybody explain (or suggest a site or paper) the exact difference between triggers, assertions and checks, and also describe where I should use them?
EDIT: I mean in database, not in any other system or language.
...
I have a project in mind that will require the majority of queries to be keyed off of lat/long as well as date + time.
Initially, I was thinking of a standard RDBMS where lat, long, and the datetime field are properly indexed. Then, I began thinking of a document based system where the document was essentially a timestamp and each doc...
I have this sql query:
SELECT
S.SEARCH,
S.STATUS,
C.TITLE AS CategoryName,
E.SEARCH_ENGINES AS Engine,
S.RESULTS,
S.DATE,
S.TOTAL_RESULTS AS Total,
S.ID
FROM
PLD_SEARCHES AS S
Join PLD_CATEGORY AS C ON C.ID = S.CATEGORY_ID
Join PLD_SEARCH_ENGINES AS E ON S.SEARCH_ENGINES_ID = E.ID
ORDER BY S.DATE ASC
I want to identify if S.STATUS is...
Hi,
i've coded a tiny forum software in php where people posts threads, and i want to support tags.
How many SQL tables should i make for this ? and briefly how the tags system will work?
Thanks
...
I've been working for quite a while now with LINQ. However, it remains a bit of a mystery what the real differences are between the mentioned flavours of LINQ.
The successful answer will contain a short differentiation between them. What is the main goal of each flavor, what is the benefit, and is there a performance impact...
P.S.
I ...
I tried using "Exist" and "IN". Not only did I not succeed, it didn't seem as an efficient solution.
Here is a simplified example:
TblMyTable
UserName1 - Grade - UserName2 - Grade
I need a query where there is a mutual relation / existence.
What I mean is that the returned result from the query will only include the users wh...
Whats wrong with my query?
ALTER TABLE test_posts ADD sticky boolean NOT NULL default = false
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '=false' at line 2
...
I have 3 database tables:
article
article_has_tag (2 FK's to the other tables)
tag
I currently show a list of articles with the article's tags shown underneath but the number of queries grows as the list gets longer.
I want to loop over all the articles and get the tag objects from each one in turn.
Can it be done in 1 propel query...
Hi, I wonder if there is a canonical way to convert data from long to wide format in SQLite (is that operation usually in the domain of relational databases?). I tried to follow this example for MySQL but I guess SQLite does not have the same IF construct... Thanks!
...
Hi,
I have two tables entitytype and project. Here are the create table statements:
Create table project (
pname varchar(20) not null,
primary key(pname)
);
create table entitytype(
entityname varchar(20) not null,
toppos char(100),
leftpos char(100),
pname varchar(20) not null,
primary key(entityname),
foreign key(pname) refe...
Hey guys, I am just trying to pull all the records from my database who have a rec_date (varchar) stored as m/d/Y and are expired (as in, less than curdate()), and this call isn't giving me what I want:
SELECT member_id,
status,
DATE_FORMAT(STR_TO_DATE(rec_date, '%m/%d/%Y'), '%Y-%m-%d') AS rec
FROM members
WHERE rec_...
As part of my jobs, I need to writes SQL queries to connect to our PI database. To generate a query, I need to pass an array of tags (essentially primary keys), but these have to be inserted as strings.
As this will be a modular query and used for multiple tags, a placeholder is being used.
The query relies upon the use of the WHERE IN...
I have a table called Employee with the following fields:
EmpID
Salary
Name
I want to get top two employees with maximum salary. How do I write this query ?
...
for tables with > 1,000,000 rows and possibly many many more !
haven't done any benchmarking myself so wanted to get the experts opinion.
Looked at some articles on row_number() but it seems to have performance implications
What are the other choices/alternatives ?
...
in DB2 while executing a query i got
SqlException: DB2 SQL Error: SQLCODE=-668, SQLSTATE=57016
does someone knows what this code means?
...
Hi
What I would like ask is best illustrated by an example, so bear with me. Suppose I have the following table:
TypeID Gender Count
1 M 10
1 F 3
1 F 6
3 M 11
3 M 8
I would like to aggregate this for every possible combination of TypeID and Gender...