create-table

What does regclass signify in Postgresql

社会主义新天地 提交于 2019-12-02 23:20:38
I have the following line in a CREATE TABLE statement: field1_id bigint DEFAULT nextval('table1_field1_id_seq'::regclass) NOT NULL, What does regclass signify in the above? Is it an absolute requirement to add ::regclass ? N.B: I had seen the Postgresql documentation link which tells about regclass , but couldn't understand it. No, you do not need the cast to regclass when calling a function like nextval that accepts a regclass parameter, as there is an implict cast from text to regclass . In some other contexts an explicit cast to regclass may be required. Explanation: ::regclass is a cast,

Why is my table not being created?

∥☆過路亽.° 提交于 2019-12-02 17:21:30
问题 I've got this code in my Winforms app to create a table in an existing database, (which I created by following what is written here): private void CreateTables() { string connStr = @"Data Source= (LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory| \AYttFM.mdf;Integrated Security=True"; using (var connection = new System.Data.SqlClient.SqlConnection(connStr)) { try { connection.Open(); using (var command = connection.CreateCommand()) { StringBuilder sb = new StringBuilder(); sb.Append(

create table in postgreSQL

帅比萌擦擦* 提交于 2019-12-02 14:48:44
I do not understand what is wrong with this query? Query tool does not want to create a table in PostgreSQL. CREATE TABLE article ( article_id bigint(20) NOT NULL auto_increment, article_name varchar(20) NOT NULL, article_desc text NOT NULL, date_added datetime default NULL, PRIMARY KEY (article_id) ); First the bigint(20) not null auto_increment will not work, simply use bigserial primary key . Then datetime is timestamp in PostgreSQL. All in all: CREATE TABLE article ( article_id bigserial primary key, article_name varchar(20) NOT NULL, article_desc text NOT NULL, date_added timestamp

Create table with COUNT ms-access

给你一囗甜甜゛ 提交于 2019-12-02 12:26:39
I have a database and I want to create a table with COUNT function in it. Is it possible ? I have 3 existing tables: Member Feedback Attendance In Feedback table, 2 columns Class_ID, Likes (Class_ID link with the attendance, as each member attend 1 class eg. class 1,2,3,etc. and Likes is for the number of people like the class). In Attendance table, 3 columns: Class_ID Member_ID Non_member_name Now I want to alter Feedback table to add 2 new columns. One to count the number of people attend the class, e.g if there is 4 people attend class 1,there would be 4 rows of Class_ID=1. Two to count the

Oracle schema user cannot create table in procedure

牧云@^-^@ 提交于 2019-12-02 11:45:28
I'm trying to create a temporary table in a procedure: PROCEDURE pr_create_tmp_bp_table(fp_id NUMBER) IS tbl_name CONSTANT VARCHAR2(20) := 'BP_TO_DELETE'; BEGIN -- sanity checks removed for readablity EXECUTE IMMEDIATE 'CREATE GLOBAL TEMPORARY TABLE ' || tbl_name || ' ' || 'ON COMMIT PRESERVE ROWS AS ' || 'SELECT * FROM infop_stammdaten.bp'; END; If I copy the BEGIN.._END block to a SQL worksheet everything works fine. So I think the user has the right to create a temporary table. If I execute the procedure from the same SQL worksheet I get Fehlerbericht - ORA-01031: Nicht ausreichende

Syntax error 1064 in CREATE TABLE statement with TINYTEXT columns?

青春壹個敷衍的年華 提交于 2019-12-02 09:22:37
This is the MySQL code I have so far: CREATE DATABASE bankbase; USE bankbase; CREATE TABLE clienttable( ClientID SMALLINT(15) NOT NULL DEFAULT 0, ClientFirstName VARCHAR(30) NOT NULL DEFAULT "first name", ClientLastName VARCHAR(30) NOT NULL DEFAULT "last name", ClientPhone CHAR(10) NOT NULL, ClientEmail TINYTEXT(30) NULL, ClientAddress TINYTEXT(128) NOT NULL, PRIMARYKEY(ClientID) ); CREATE TABLE branchtable( BranchID SMALLINT(15) NOT NULL DEFAULT 0, BranchCity TINYTEXT(30) NOT NULL DEFAULT city, BranchManagerFName VARCHAR(30) NULL DEFAULT "Branch Manager's First Name", BranchManagerLName

how to populate database using procedures

本秂侑毒 提交于 2019-12-02 09:21:55
I have about 15 different Tables filled with different data and different entity relationships. I need to create a script which will populate my database with the content of those tables. After script is finished, i run it in cmd, using sqlplus and later START path to file i have two different sql files, one named db_spec.sql and another db_body.sql. In my db_body.sql i've created a procedure to store data from two tables which have 1:N relationship. First table CREATE TABLE LOCATION ( ID_LOCATION INTEGER NOT NULL, LOCATION_NAME VARCHAR2 (20) NOT NULL, POSTCODE INTEGER NOT NULL ); ALTER TABLE

Why is my table not being created?

强颜欢笑 提交于 2019-12-02 08:32:02
I've got this code in my Winforms app to create a table in an existing database, (which I created by following what is written here ): private void CreateTables() { string connStr = @"Data Source= (LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory| \AYttFM.mdf;Integrated Security=True"; using (var connection = new System.Data.SqlClient.SqlConnection(connStr)) { try { connection.Open(); using (var command = connection.CreateCommand()) { StringBuilder sb = new StringBuilder(); sb.Append("CREATE TABLE [dbo].[AssignmentHistory] "); sb.Append("("); sb.Append("[Id] INT NOT NULL PRIMARY KEY, ");

Saving the output of a dynamic query that uses refcursor into a table

落爺英雄遲暮 提交于 2019-12-02 07:37:45
问题 In continuation to a previous case, in which a dynamic SELECT query that uses refcursor was created and then was executed - I would like to ask the following: The desired output that we got from the indicated procedure was output into the DataOutput. I would like to find a way to store the data into a new table in the db. Instead of the straight forward command: CREATE TABLE mydaughtertable AS SELECT enrich_d_dkj_p_k27ac,enrich_lr_dkj_p_k27ac,enrich_r_dkj_p_k27ac FROM dkj_p_k27ac The idea is

ERROR 1005 (HY000): Can't create table 'shrewd_db.alert_disable_register' (errno: 150)

不想你离开。 提交于 2019-12-02 07:16:03
问题 I want to create a table in MySQL by running following SQL, CREATE TABLE IF NOT EXISTS `shrewd_db`.`alert_disable_register` ( `id_alert_disable_register` MEDIUMINT NOT NULL AUTO_INCREMENT, `id_label` MEDIUMINT UNSIGNED NULL, `id_indicator` MEDIUMINT UNSIGNED NULL, `id_user` MEDIUMINT UNSIGNED NULL, `active` TINYINT(1) NULL DEFAULT 1, `id_alert_disable_rule` MEDIUMINT NULL, `id_escalation_plan` INT NULL, PRIMARY KEY (`id_alert_disable_register`), INDEX `id_escalation_plan_alert_rule_idx` (`id