create-table

Cannot create a new table after “DROP SCHEMA public”

*爱你&永不变心* 提交于 2019-12-17 22:27:03
问题 Since I wanted to drop some tables and somebody suggested the below and I did it: postgres=# drop schema public cascade; DROP SCHEMA postgres=# create schema public; CREATE SCHEMA Then I got problem when creating a new database, such as: postgres=# create database test; CREATE DATABASE postgres=# \c test You are now connected to database "test" as user "postgres". test=# create table hi(id int primary key); *ERROR: no schema has been selected to create in* You can see I got error ERROR: no

Create Table in Hive with one file

☆樱花仙子☆ 提交于 2019-12-17 07:56:13
问题 I'm creating a new table in Hive using: CREATE TABLE new_table AS select * from old_table; My problem is that after the table is created, It generates multiple files for each partition - while I want only one file for each partition. How can I define it in the table? Thank you! 回答1: There are many possible solutions: 1) Add distribute by partition key at the end of your query. Maybe there are many partitions per reducer and each reducer creates files for each partition. This may reduce the

Create Table in Hive with one file

妖精的绣舞 提交于 2019-12-17 07:56:03
问题 I'm creating a new table in Hive using: CREATE TABLE new_table AS select * from old_table; My problem is that after the table is created, It generates multiple files for each partition - while I want only one file for each partition. How can I define it in the table? Thank you! 回答1: There are many possible solutions: 1) Add distribute by partition key at the end of your query. Maybe there are many partitions per reducer and each reducer creates files for each partition. This may reduce the

Creating a new table and setting the expiration date in bigquery using Python

喜欢而已 提交于 2019-12-14 04:23:23
问题 This is my code that pulls the realtime database from firebase, formats it in a Json, uploads to the cloud and then to BQ. #standardsql import json import boto import gcs_oauth2_boto_plugin import os import shutil import StringIO import tempfile import time import argparse import uuid from firebase import firebase from google.cloud import storage from google.cloud.storage import blob from google.cloud import bigquery firebase = firebase.FirebaseApplication('https://dataworks-356fa.firebaseio

Creating table with variable name php mysql

你说的曾经没有我的故事 提交于 2019-12-14 03:27:16
问题 I'am trying to create table with variable name and columns via forms here's my query $execute = mysql_query('CREATE TABLE '.$tName.'( '.$cName.' '.$cType.' )'); And it's creating table with name from variable $tName but it doesnt create the columns. 回答1: Try this: $sql= "CREATE TABLE $tName($cName $cType(45),$cName $cType(50))"; //echo $sql; $op =mysql_query($sql); 回答2: OK try this, I think it gives the general idea <?php include 'connect-db.php'; $tbl_name='kerry'; $field1='name'; $field2=

how to use foreign-keys with hsql create table?

假装没事ソ 提交于 2019-12-13 18:06:07
问题 could someone explain me how to use foreign keys in hsql? I would like it in an create table, but working alter table is also ok. I am working without tools, just in eclipse whats wrong with the hsql code? CREATE TABLE user( t_id INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 1, INCREMENT BY 1) PRIMARY KEY, name VARCHAR(30), lastname VARCHAR(30), email VARCHAR(30), --FOREIGN KEY (b_id) REFERENCES bookingnumber(b_id) ); CREATE TABLE bookingnumber ( b_id INTEGER PRIMARY KEY ); ALTER TABLE

ORA-00904: : invalid identifier while table creation

余生长醉 提交于 2019-12-13 05:11:22
问题 CREATE TABLE T_Option_Details ( Option_Id NUMBER(2), Question_ID INTEGER NOT NULL, Option VARCHAR2(500) NOT NULL); Error at line 3 ORA-00904: : invalid identifier 回答1: OPTION is an oracle reserved keyword, Try with some other column name like this, CREATE TABLE T_Option_Details( Option_Id NUMBER(2), Question_ID INTEGER NOT NULL, OPTION_N VARCHAR2(500) NOT NULL) 来源: https://stackoverflow.com/questions/20208918/ora-00904-invalid-identifier-while-table-creation

MySQL implementing tables into database

孤人 提交于 2019-12-13 04:43:11
问题 I have to implement the tasks below: Task: At present, the database knows two types of messages: Messages that a user posts and that are public for anyone and everyone to read Messages that a user posts and that are non-public. These messages can only be read by users that the posting user has marked as friends. In this step, you should add a third type of message. This third type of message should be readable by specified recipients only. This means the database needs to provide the

CREATE TABLE INSIDE PROCEDURE

别来无恙 提交于 2019-12-13 02:55:47
问题 I can't seem to create the table inside this procedure. I read it online that for any DDL, I need to use EXECUTE IMMEDIATE and tried following few examples online. However, even after trying several solutions it keeps failing. ' Error ""ORA-00904: "End": invalid identifier ORA-06512: at "EXTRACT_AUTOMATED_CHECKS", line 89 " CREATE OR REPLACE PROCEDURE EXTRACT_AUTOMATED_CHECKS AS BEGIN --DROP TABLE BEGIN EXECUTE IMMEDIATE ('DROP TABLE extract_checks') ; EXCEPTION WHEN OTHERS THEN NULL; END; -

Using TCL: Sqlite syntax error when creating table in memory temp table

。_饼干妹妹 提交于 2019-12-13 02:49:45
问题 using tcl and sqlite3 I would like to create a temporary table in memory. Trying this: package require sqlite3 sqlite3 DB [file normalize X:\memdbtest.db] DB eval { ATTACH DATABASE ':memory:' AS memdb; CREATE TEMP TABLE memdb.values (val TEXT); } Gives me an error: near "values": syntax error This I gues has to do with that "values" is a reserved keyword in sqlite. Changing the above code to: DB eval { ATTACH DATABASE ':memory:' AS memdb; CREATE TEMP TABLE memdb.things (val TEXT); } gives me