ubuntu - How to use CREATE TABLE queries in LibreOffice Base?

21
2014-04
  • Shlomi Loubaton

    I'm using LibreOffice 3.5.4.2 (from Ubuntu 12.04 packages) and trying to create tables using SQL's CREATE TABLE statement. For the first few attempts I got a message saying that the query must be a SELECT query. I changed the query and made it extremely simple:

    CREATE TABLE moo3 (id_1 INT, name_1 VARCHAR(255));
    

    Now the query seems to be executed, returning no results, but I can't find the table in Base's GUI. Is it a bug or am I doing it wrong?

  • Answers
  • W_Whalley

    You need to View/Refresh Tables to see the change. If you want to keep the lower case field names, you need to quote the them (at least in the embedded database SQL tool). And I realize that this is just a test, but you need to have a primary key field defined in order to enter data from the GUI. You could get data into the table other ways.


  • Related Question

    Dynamic Filtering on LibreOffice Base Reports
  • LantisGaius

    Is it possible to do a Dynamic Filtering on LibreOffice Base Reports?


  • Related Answers
  • Simon Sheehan

    Yes. If you are using the default database type. Build the table on a query with parameters. That is, if you have a table T and want to filter on a field A in the table, set up a query like this: SELECT * FROM T WHERE A=:parameter

    You will be prompted for the parameter when you open the table. Only matching records are printed.

    You can even include the parameter value in the table, at least when using the libreoffice report builder extension

  • Simon

    could be possible to use a dummy like

    SELECT * FROM T WHERE A:=parameter (OR A=anyregister IF they pres RETURN without write anything)
    

    The idea is ask a lot of parameters to the user, and the user decide what parameters must be used