[Tutor] mysqlite

Lolo Lolo losermeloser at yahoo.com
Thu Mar 7 00:25:15 CET 2013


> You are missing cur.execute('SELECT * from users')


thanks:) this has fixed the 1st issue.
 
 guys i still cant use the command line. but i guess i dont really mind as i can just make a .py file... 
i am having a lot of fun reading through alan's tutorial, everything is becoming very clear but can someone please explain this to me.
 
update Employee
set ManagerID = (Select EmpID 
                 from Employee 
   where Name = 'John Brown')
where Name = 'Fred Smith' OR 
      Name = 'Anne Jones';
 
 
this is saying set the managerID of 'Fred Smith' or 'Jane Brown' to the ID returned in the nested select statement?
 
and this:
 
drop table author;
create table author (
ID Integer PRIMARY KEY,
Name String NOT NULL
);

drop table book;
create table book (
ID Integer PRIMARY KEY,
Title String NOT NULL
);

drop table book_author;
create table book_author (
bookID Integer NOT NULL,
authorID Integer NOT NULL
);

 
sqlite> SELECT title from book, book_author ...> where book_author.bookID = book.ID ...> and book_author.authorID = (select ID from author  ...>                             where name = "Jane Austin"); 
 
maybe its simple but because its more complex im finding it hard to read. we want a title from book, 
which is the field that will be returned, but why is book_author also in the select statement when it isnt
being returned? or are we actually returning every single field from book author?
 
so if the author.bookID is equal to book.ID, also check that this ID from author matches the authorID from 
book_author.authorID ? after comprehending this im lost in my thoughts. can someone tell me how these are
linked. so the whole output is really dependent on the answer from the 2nd condition after the and?:
...> and book_author.authorID = (select ID from author 
where name = "Jane Austin");  


More information about the Tutor mailing list