On 1 Nov 2011, at 10:25am, Stander, Bertus (Pretoria) wrote:
> If I create a table as illustrated below.
>
> CREATE TABLE Testing (
>
> ID INTEGER PRIMARY KEY AUTOINCREMENT,
>
> Tbl_Name VARCHAR (45));
In this example you have a TABLE called 'Testing' and a COLUMN called
'Tbl_Name'.
> The value of 'Tbl_Name' is set to 'My_Table'
>
> Will it be possible to read the values in table My_Table using the field
> 'Tbl_Name'?
>
> Select * from Testing.Tbl_Name;
>
> The tests I have performed is not working.
Good commands for your above example would be
INSERT INTO Testing (Tbl_Name) VALUES ('My_Table');
SELECT * FROM Testing;
SELECT ID,Tbl_Name FROM Testing;
SELECT ID FROM Testing WHERE Tbl_Name = 'My_Table';
However, the names you have picked are a little strange unless you are storing
information about tables. It would be more normal to see
CREATE TABLE My_Table (
ID INTEGER PRIMARY KEY AUTOINCREMENT,
My_Column TEXT);
INSERT INTO My_Table (My_Column) VALUES ('example row');
SELECT * FROM My_Table;
SELECT ID, My_Column FROM My_Table;
SELECT ID FROM My_Table WHERE My_Column = 'example row';
Simon.
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users