Questions tagged [ddl]

Data Definition Language is a subset of SQL to manipulate structural elements of a database, not the content of tables. CREATE, DROP, ALTER and related statements.

Data Definition Language is a subset of SQL to manipulate structural elements of a database, not the content of tables. CREATE, DROP, ALTER and related statements. It is often restricted to database users with administrative privileges.

Related tags

2245 questions
0
votes
0 answers

What do oracle database create in the table columns 'SYS_###########'?

While investigating for solution for a task , I was triggered by the following result of my simple query SELECT DISTINCT table_name, column_name FROM all_tab_cols tc WHERE upper(table_name) LIKE 'M_INOUT' ORDER BY table_name I…
0
votes
1 answer

SQL: Include a new column in an index

I have a nonclustered index over two rows in a table, and that includes a number of columns. The index is used by a view and the view has now been updated to include another column. I generally script database changes so that they test first if the…
David Clarke
  • 12,888
  • 9
  • 86
  • 116
0
votes
1 answer

Gcloud crashed (ValueError): Invalid header value

I used the following DDL command to create a table in gcloud spanner database named "messages" in the "guestbook" spanner instance gcloud spanner databases ddl update messages \ --instance=guestbook…
Roshana
  • 357
  • 1
  • 3
  • 17
0
votes
1 answer

Why is my "CREATE INDEX CONCURRENTLY .." command blocked by a "SELECT FROM" query? (Postgres 9.6)

I was running a migration to create an index, but the migration was blocked by another query. I resolved the problem after discovering that there was another query blocking my migrations; and after cancelling the blocking query, I was able to…
modulitos
  • 14,737
  • 16
  • 67
  • 110
0
votes
0 answers

Is there any possible way in Postgres to list and store newly created table automatically?

Context : I am keeping one counter table to store max counters of all the tables in the public schema. (Which are updating automatically with trigger or functions upon updating main table) But if someone created a new table in DB and forgot to add…
SOHAM N.
  • 110
  • 8
0
votes
0 answers

Computed column in POSTGRESQL-Column Derived from a function

Want to create a COMPUTED COLUMN in POSTGRESQL which has to be a migration of MSSQLCODE .The computed column is as a result of a function "FUN_GetExternalSystemNameFull" MSSQL CODE FOR TABLE CREATE TABLE ClientApplication( ClientApplicationId…
0
votes
1 answer

Creating a check SQL check constraint to validate that an NVARCHAR column contains valid SQL

I'm attempting to write a check constraint on an NVARCHAR(MAX) column in my database. This column will be filled with SQL, and I want to make sure that it is only populated with SQL. Is it possible to write a check constraint to make sure that this…
Wpowell
  • 31
  • 3
0
votes
1 answer

Problem when trying to convert CHECK with subqueries to a function in SQL

I've been sitting with this problem for hours and I'm on the verge of going crazy. I want each Student to only be able to study a maximum of 45 courseCredits. At this point it prohibits me from adding more than a total of 45 CourseCredits. How am I…
0
votes
1 answer

How to create an create user in Oracle using Execute Immediate?

My database is an XE 18. My user has create user and I can create an user in SQL Plus, using this : ALTER SESSION SET "_ORACLE_SCRIPT" = true; CREATE USER auxiliar IDENTIFIED BY auxiliar2020 ; Then I create a package with a function that should be…
0
votes
1 answer

Oracle Index building/dropping history

Is there a Metadata table that logs the 'Create/Drop' index history? I found the 'ALL_TAB_MODIFICATIONS' and 'ALL_TAB_STATS_HISTORY' tables, but they don't have index building logs.
Dozel
  • 149
  • 1
  • 10
0
votes
0 answers

How can I parametrize creation of tables in a database?

I have a list of items (contained in a text file list.txt): //list.txt item1 ... itemN I need to create a table in a database for each item: table_item1 ... table_itemN I don't want to do it manually, so I'm looking for a way to automate this. Can…
Daniel
  • 295
  • 2
  • 9
0
votes
2 answers

Property hibernate.hbm2ddl.auto not working as expected (MySQL 5.7)

what I want to achieve: Write a little class that creates a schema during startup. If the schema exists, it should be dropped and re-created. I have to say I'm quite new to Hibernate, so chances are the error is on my side. The program runs fine the…
greg
  • 212
  • 2
  • 8
0
votes
1 answer

Mariadb Database level trigger

CREATE TRIGGER safety_drop ON DATABASE FOR DROP_TABLE AS BEGIN SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'DELETING NOT ALLOWED'; ROLLBACK; END ERROR #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB…
0
votes
1 answer

How to restrict input to only whole numbers in Oracle?

I am making a naive ratings platform db and I want to restrict a rating to be whole numbers from 1 to 5. To clarify I do not want to round or truncate, I want it to show a constraint violation if anything except 1,2,3,4,5 is entered. The data type…
0
votes
1 answer

alter table add column using %TYPE oracle

Can we add a column in a table using the datatype of a column from another table. NO PLSQL. just a normal SQL query eg as below *Table ABC has 3 columns name varchar2(50) id number dob Date Table XYZ has 2 columns id number phone_number…