Обсуждение: questions
2 questions. 1)Hi, I have this 2 tables: esame=> select * from libro_autore\g id_libro|id_autore --------+--------- s1 | 5 n3 | 1 n2 | 2 n1 | 1 n1 | 4 and esame=> select * from autore\g cognome|nome |data_nascita|luogo_nascita|id_autore -------+----------+------------+-------------+--------- King |Stephen | 01-12-1940|NY | 1 Tamaro |Susanna | 15-02-1965|Milano | 2 Clancy |Tom | 05-05-1968|Los Angeles | 3 Straub |Peter | 01-01-1950|Milano | 4 Maraini|Dacia | 05-04-1962|Catania | 5 Zorza |Alessandra| 05-05-1974|Cernusco | 6 Now I want to found Cognome, Nome and number of books foreach "id_autore" in the libro_autore table. I have think a SQL-statement like SELECT a.cognome, a.nome,la.id_autore, count(*) from libro_autore la, autore a group by l a.id_autore\g (ok this is not correct). Any ideas ?? 2)Now I have this table: esame=> select * from view1\g id_libro|id_utente|tipo --------+---------+---- n3 | 9| 1 (1 row) (for the moment only 1 item, but this table can contains more and more items). I want to find a way that return me for each "id_utente" the number of books group by "tipo". "Il divertimento e' giusto se la scimmia ci prende gusto" -- Italian Linux Meeting - http://www.pluto.linux.it/meeting/ -- Morelli 'ZioBudda' Davide Michel - Member of Pluto Linux User Group michel@enter.it - http://ziobudda.enter.it/ Linux Problem? Ask to linux@media.dsi.unimi.it "/dev/ziobudda: access to /var/tmp/beer denied, use /var/adm/pineapple"
I've sent this onto the mailng lists... On Mon, 11 Jan 1999, Jixue Jerry Liu wrote: > Dear Marc, > > My name is Jixue Liu, a PhD student in the School of Computer Science, > University of South Australia. I am studying view maintenance in OR > Systems. The model I study most and the system I use is Postgres. I > appreciate the contribution of Postgres group to the field. Now I have > some questions about the usage of the system. > > 1. How to define a relation with an attribute which takes set values? > 2. How to populate instances to a table referring another table? An > example: > Create table cities (name text, population float); > Insert into cities values ('Adelaide',100.0); > Create table people(name text, live_in cities); > How to insert a tuple into people saying that 'Jerry' lives in > Adelaide? > > > I am looking forward to hearing from you. > > Jixue Liu > > > > Marc G. Fournier Systems Administrator @ hub.org primary: scrappy@hub.org secondary: scrappy@{freebsd|postgresql}.org