Hướng dẫn how do i create a database in postgresql using python? - làm cách nào để tạo cơ sở dữ liệu trong postgresql bằng python?
Xem thảo luận Show
Cải thiện bài viết Lưu bài viết Xem thảo luận Cải thiện bài viết Lưu bài viết Đọc Bàn luận is one of the Data Definition Language ( DDL ) statements supported by the PostgreSQL Database Management System. It is used to create database in PostgreSQL. Database name should be always unique. If it already exists then it shows that the particular database already exists.
Tạo cơ sở dữ liệu là một trong những câu lệnh Ngôn ngữ định nghĩa dữ liệu (DDL) được hỗ trợ bởi hệ thống quản lý cơ sở dữ liệu PostgreSQL. Nó được sử dụng để tạo cơ sở dữ liệu trong PostgreSQL. Tên cơ sở dữ liệu phải luôn luôn duy nhất. Nếu nó đã tồn tại thì nó cho thấy cơ sở dữ liệu cụ thể đã tồn tại. & NBSP;Python3Cú pháp: Tạo cơ sở dữ liệu cơ sở dữ liệu_name; Ví dụ: Tạo cơ sở dữ liệu bằng PysCOPG2 & NBSP; 3 4 1 6 7 8 9 1 1 7 8 4 1 6 7 8 9 1 1 7
7 0____11 2 8 4 1 6 8 1 0 7 8 90 1 2
Database has been created successfully !!
create database test;
con = psql.connect(dbname='postgres',
user=self.user_name, host='',
password=self.password)
cur = con.cursor()
cur.execute("CREATE DATABASE %s ;" % self.db_name)
create database test;
|