ddl

ORA-00904: “ID”: invalid identifier

徘徊边缘 提交于 2019-12-06 03:28:25
Trying to create a table with a foreign key. I keep getting ORA-00904 error. What am I doing wrong. Is it because table of the foreign key is not yet created ? CREATE TABLE ingredients( ingredient_id number(2,0), ingredient VARCHAR2(55) NOT NULL, quantity_required VARCHAR2(15) NOT NULL, optional_ingredient VARCHAR2(30) NOT NULL, CONSTRAINT pk_ingr_id PRIMARY KEY(ingredient_id), CONSTRAINT fk_ingredient_list FOREIGN KEY(id) REFERENCES ingredient_list(id) ); Take a look at the following line: CONSTRAINT fk_ingredient_list FOREIGN KEY(id) REFERENCES ingredient_list(id) Your table has no column

Hive DDL、DML操作

别说谁变了你拦得住时间么 提交于 2019-12-06 03:20:45
• 一、DDL操作(数据定义语言)包括:Create、Alter、Show、Drop等。 • create database- 创建新数据库 • alter database - 修改数据库 • drop database - 删除数据库 • create table - 创建新表 • alter table - 变更(改变)数据库表 • drop table - 删除表 • create index - 创建索引(搜索键) • drop index - 删除索引 • show table - 查看表 • 二、DML操作(数据操作语言)包括:Load 、Insert、Update、Delete、Merge。 • load data - 加载数据 • insert into - 插入数据 • insert overwrite - 覆盖数据(insert ... values从Hive 0.14开始可用。) • update table - 更新表(update在Hive 0.14开始可用,并且只能在支持ACID的表上执行) • delete from table where id = 1; - 删除表中ID等于1的数据(delete在Hive 0.14开始可用,并且只能在支持ACID的表上执行) • merge - 合并(MERGE在Hive 2.2开始可用

Cannot cast type numeric to boolean

筅森魡賤 提交于 2019-12-06 02:58:41
问题 ALTER TABLE products ALTER COLUMN power_price DROP DEFAULT; ALTER TABLE products ALTER COLUMN power_price TYPE bool USING (power_price::boolean); ALTER TABLE products ALTER COLUMN power_price SET NOT NULL; ALTER TABLE products ALTER COLUMN power_price SET DEFAULT false; Postgres gives me this error: Query failed: ERROR: cannot cast type numeric to boolean 回答1: Use: ALTER TABLE products ALTER power_price TYPE bool USING (power_price::int::bool); There is no direct cast defined between numeric

Using Visio to generate MySQL DDL

一个人想着一个人 提交于 2019-12-06 02:53:21
I have a database model diagram created in MS Visio which I would like to export to DDL file to create a MySQL database. I've already installed the MySQL ODBC driver, which I can successfully use to generate DDL file, but I have some problems anyway. Visio puts quotation marks around the table names which are also reserved words (like user). This is not OK, since MySQL uses backticks (`) and not quotation marks (") for this purpose. MySQL ODBC driver also changes the BLOB data type to LONGVARBINARY, so it cannot be used directly with MySQL when creating the database. Does anyone have any

2. ClustrixDB 文件/参数说明

≯℡__Kan透↙ 提交于 2019-12-06 02:17:03
一、日志 /data/clustrix/log/query.log 记录节点慢SQL/错误SQL/DDL 等信息,节点分开记录 Each entry in the query.log is categorized as one of these types. Specific logging for each query type is controlled by the global or session variable indicated. Query Type Description ALTER CLUSTER Changes made to your cluster via the ALTER CLUSTER command are always logged to the query.log automatically. This logging is not controlled by a global variable. BAD The query reads more rows than necessary to return the expected results. This may indicate a bad plan or missing index. Logging of BAD queries is not enabled by default (

How should I migrate DDL changes from one environment to the next?

拥有回忆 提交于 2019-12-06 01:41:39
I make DDL changes using SQL Developer's GUI. Problem is, I need to apply those same changes to the test environment. I'm wondering how others handle this issue. Currently I'm having to manually write ALTER statements to bring the test environment into alignment with the development environment, but this is prone to error (doing the same thing twice). In cases where there's no important data in the test environment I usually just blow everything away, export the DDL scripts from dev and run them from scratch in test. I know there are triggers that can store each DDL change, but this is a

mybatis执行DDL语句

烂漫一生 提交于 2019-12-05 22:06:14
对MyBatis一直停留在仅仅会用的阶段,常用的场景就是通过MyBatis对表数据进行DML(insert, delete, update等)操作,从来没有想过通过MyBatis对数据库进行DDL(create, alter, drop)操作,最近的项目需要利用MyBatis对数据库进行DDL操作,自己就尝试了一把,对MyBatis又多了点儿了解。 接口文件: xml文件: ps:按照这样的风格,log4j打印这段如下: 虽然是0,但是语句起作用了,不用担心! 来源: https://www.cnblogs.com/caozx/p/11947082.html

Delete tables from database Oracle 10g

ⅰ亾dé卋堺 提交于 2019-12-05 18:45:40
I have deleted some tables from an Oracle 10g database using the drop command. When I list the tables using select * from cat; I get the following : Are the tables deleted or not? Why do I have these BIN$... things? How can I remove them or the tables once and for all? Thanks! They are entries in the Recycle Bin, created by the deletion of a table. They can be purged if required. http://docs.oracle.com/cd/B28359_01/server.111/b28310/tables011.htm The tables prefixed with BIN$ are tables placed in the recycle bin for easy recovery. You can completely remove them by purging it. Either

How to create a Postgres table with unique combined primary key?

女生的网名这么多〃 提交于 2019-12-05 18:01:28
I have two tables named players & matches in a Postgres DB as follows: CREATE TABLE players ( name text NOT NULL, id serial PRIMARY KEY ); CREATE TABLE matches ( winner int REFERENCES players (id), loser int REFERENCES players (id), -- to prevent rematch btw players CONSTRAINT unique_matches PRIMARY KEY (winner, loser) ); How can I ensure that only a unique combination of either (winner, loser) or (loser, winner) is used for matches primary key so that the matches table won't allow the insertion of: INSERT INTO matches VALUES (2, 1); If it already has a row containing VALUES (1, 2) like :

Postgres database create if not exists [duplicate]

不问归期 提交于 2019-12-05 14:30:07
问题 This question already has answers here : Simulate CREATE DATABASE IF NOT EXISTS for PostgreSQL? (7 answers) Closed 4 years ago . Is there an analog to CREATE TABLE IF NOT EXISTS for creating databases? Background: I am writing a script to automatically set up the schema in PostgreSQL on an unknown system. I am not sure if the database (or even part of the schema) was already deployed, so I want to structure my code to not fail (or ideally even show errors) if some of the structure already