Re: Creating a table in a different database

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I just create .sql files with all the commands I want to run and then run them in psql with the "\i myscript.sql".

If you want to switch databases in psql, use the \c[onnect] [DBNAME|- [USER]] .  For example "\c my_database my_user".

I recommend going into psql and typing in "\?" for a list of common commands you can use.

-Aaron

On 6/6/06, Simon Dale < sdale@xxxxxx> wrote:

Hi,

 

The CREATE TABLE command creates a table in the current database. What I want to achieve is a SQL script that will create a database and a user and then create some tables and functions in the new database.

 

Is it possible to do this in a single SQL file, and if so, how do I change the database part way through the file to create the tables in the correct database?



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux