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
2 answers

convert values from two columns into one new column

I have two columns: year and month: Year Month 2017 01 2017 02 2018 12 2019 06 2020 07 With select to_date(concat(Year, Month), 'YYYYMM') csv_date FROM my_table; I can get just one column with date datatype. How can I add this…
Rafael Higa
  • 655
  • 1
  • 8
  • 17
0
votes
1 answer

not able to Invert bitand value using bitnot, e.g from 1 to 0 in pl/sql

Creating a virtual column whose value is computed using other 3 columns - CREATE TABLE emp ( id NUMBER, comm1 number, comm2 number, comm3 number, comm4 number GENERATED ALWAYS AS ((comm1 -…
Harasha
  • 1
  • 1
0
votes
1 answer

Postgres: update column type and parse column value from json to float

Example Table: CREATE TABLE example_table ( example_column TEXT, ) Example Record (json stored as text): INSERT INTO example_table VALUES ('{"value": "1.3", "Type": "float"}') Goal is to: Update column type to Double Precision Update the…
user2263572
  • 5,435
  • 5
  • 35
  • 57
0
votes
2 answers

Add constraints for a foreign key that references multipleprimary keys from different tables in SQL Plus?

I'm a beginner learning SQL and am having trouble implementing this concept. Suppose you create the following three tables: CREATE TABLE dogOwner( ownerNo VARCHAR(8) CONSTRAINT ownerNo_pk1 PRIMARY KEY, ownerName VARCHAR(10) ); CREATE TABLE…
0
votes
1 answer

RabbitMQ custom table source and sink for pyflink 1.11

According to the docs here: https://ci.apache.org/projects/flink/flink-docs-release-1.11/dev/table/connectors/ and https://ci.apache.org/projects/flink/flink-docs-release-1.11/dev/table/connectors/ is it possible to create a custom ddl RabbitMQ…
0
votes
1 answer

MySQL 8: Create Collections via DDL

I’d like to be able to create MySQL Document Store Collections via simple SQL DDL statements rather than using the X-Protocol clients. Is there any way to do so? Edit: I’ll try and clarify the question. Collections are tables using JSON datatypes…
raine
  • 817
  • 1
  • 15
  • 26
0
votes
1 answer

Syntax error h2 database in postgresql compatibility

When the following snippet is executed in h2 databse (compatibility POSTGRESQL) I encounter syntax error which seems to be reported by h2: org.h2.jdbc.JdbcSQLSyntaxErrorException: Syntax error in SQL statement " …
skywalker
  • 696
  • 2
  • 16
  • 37
0
votes
1 answer

Will it help if I check if a SQL Server trigger is enabled before I try to disable it?

I'm trouble-shooting some performance problems in a SQL Server database, and one of the things I found is that the stored procedures frequently disable and re-enable triggers. I'd love to have the authority and the time to redesign the thing so that…
Brendan Reynolds
  • 991
  • 2
  • 9
  • 19
0
votes
1 answer

How to write new column with check constraint to allow only values Y, N?

How to write new column with check constraint to allow only values Y, N ?
0
votes
1 answer

VB.Net, MVC3, Razor, EF 4.1 DB First, and Linq - Populating DDL Options and Values

Background - I'm trying to populate a drop down list with state information from a database. I'd like the full state name to be the option and the state abbreviation to be the value. Example: Current Progress -…
Justin
  • 3
  • 2
0
votes
2 answers

Insert into as select from array and struct table in HIVE

I'm having a hard time to insert structured arrays into a table as select from another one: this is my create table: create table temp4 ( nome_1 string ,array_nm1 array
0
votes
1 answer

Extract and process select/update query constraints in Teiid ddl in Virtual DB

I am using Teiid vdb model where i need to extract query constraints inside the ddl and use it in a stored procedure to fetch results of my choice. For example, if I run following query : select * from Student where student_name = 'st123', i want to…
0
votes
1 answer

Best way to add multi column constraint with PSQL

I have an availability table : CREATE TABLE availability ( id SERIAL PRIMARY KEY, user_id int REFERENCES users(id) NOT NULL, address_id int REFERENCES addresses(id) ON DELETE CASCADE, day_of_week int NOT NULL, start_mn int, …
Ado Ren
  • 3,511
  • 4
  • 21
  • 36
0
votes
1 answer

AWS Athena create external table succeeds even if AWS s3 doesn't have file in it?

create external table reason ( reason_id int, retailer_id int, reason_code string, reason_text string, ordering int, creation_date date, is_active tinyint, last_updated_by int, update_date date ) ROW FORMAT SERDE…
artem
  • 24
  • 2
0
votes
2 answers

Data disappears when I JOIN the final table - SQL

I have this query I need to complete where I need to return the Name of the customers who brought items on a certain date and the name of each item. However, whenever I JOIN the customer table to the other tables it essentially comes back as NULL.…
Steven Hale
  • 206
  • 3
  • 15