Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Easy Queries Not Working

Author  Topic 

gretty
Starting Member

6 Posts

Posted - 2010-04-16 : 21:51:37
Hello

I am a programmer using SQLite3 to create a database for an application. I have been running into some problems with my SQL queries which I dont think are correct. Can you check them & correct them where relevant?

Right now only one table exists, its layout is like so:
quote:

Table = element
2 columns = property TEXT PRIMARY KEY, value TEXT

ie, CREATE TABLE element(property TEXT PRIMARY KEY, value TEXT)


Are these queries correct?

Check if property value already exists in table:

SELECT property
FROM element
WHERE property == X;


If I get NULL back that will mean that this property does not exist in the table? Is this correct?

Change the value in a row where property equals color:

DELETE value
FROM element
WHERE property == 'color';

INSERT INTO element(value)
VALUE('orange')
WHERE property == 'color';

commit;


Also I want to create a new TABLE with the name '#element' or '.element' but I always get an error because of the '#' & '.' characters. Is it possible to create a table with a '#' or '.' character in its name?

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2010-04-16 : 22:15:29
We can't advice you on this. It's best that you post in a SQLite forum. SQLTeam.com is for Microsoft SQL Server


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -