Why is it that when I try to create a table using the "Create Table" statement, I keep getting an error saying "Near '(': syntax error"?

Error :

There seems to be a syntax error near "(".

Here is the SQL statement causing the issue:

CREATE TABLE IF NOT EXISTS tickets (
    numero INTEGER PRIMARY KEY AUTOINCREMENT,
    identifier VARCHAR(4) NOT NULL,
    subject VARCHAR(150) NOT NULL,
    concerned_staff TEXT NULL,
    author_id VARCHAR(22) NOT NULL,
    created_at TIMESTAMP NOT NULL DEFAULT current_timestamp(),
    is_archived BOOLEAN NOT NULL DEFAULT false,
    ticket_channel_id VARCHAR(24) NOT NULL
);

I am puzzled as to why this error is occurring. The only other question I found here does not address my specific situation. My aim is to retrieve a numerical representation of time. Instead of having 21-12-2022 10:00:00, I want to receive 1671613200.

Answer №1

I am struggling to comprehend the reasoning behind this.

Replace current_timestamp() with CURRENT_TIMESTAMP.

I prefer having 1671613200 over 21-12-2022 10:00:00.

created_at TIMESTAMP is associated with a numeric affinity, whereas CURRENT_TIMESTAMP yields a string value. Consider using unixepoch() instead:

created_at TIMESTAMP NOT NULL DEFAULT (unixepoch()),

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Organize table information using rowspan functionality

View of Current Table I am looking to implement a side column in my table using rowspan to group dates within each pay period. The goal is for a supervisor to be able to create a new pay period, which will assign a unique integer in the database and then ...

Rendering Information in Angular 4 Through Rest API

Encountering issues displaying data from my local express.js REST API, organized as follows: people: [{ surname: 'testsurname', name: 'testname', email: '<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemai ...

Is there a way to modify material-ui Input without needing a save button?

Is there a way to automatically save changes in the GraphQL without using a save button? I have implemented code that functions as intended, but with a strange issue. When typing "hello" in the input field, it saves multiple times as individual letters, ra ...

Writing TypeScript, Vue, and playing around with experimental decorators

After creating a Vue project through Vue-CLI v3.0.0-beta.15, the project runs smoothly when using npm run serve. However, TypeScript displays an error message stating that support for decorators is experimental and subject to change in a future release, bu ...

What exactly is an npm "modular construction" and what is the process for setting it up?

I am aiming to integrate sortablejs's MultiDrag feature with Vuejs2 and Typescript. The official documentation states: MultiDrag is a plugin for SortableJS, but it may not be included in all of Sortable's builds. It comes pre-installed in the ...

Retrieve the value of [routerLinkActive] in the component's class

Recently, I've been working on a tab component called TabComponent and it includes the following HTML template: <a [routerLink]='link' [routerLinkActive]="[is-active]">link label</a> <button>Close tab</button> The c ...

Troubleshooting a Type Parameter Error in React Native TypeScript

I am working on a project in React Native using TypeScript, and I encountered this issue: I am getting the error Argument of type 'GestureResponderEvent' is not assignable to parameter of type 'SetStateAction<string>'.ts(2345) wit ...

Why does WebStorm fail to recognize bigint type when using TSC 3.4.x?

Currently, I am working on the models section of my application and considering switching from using number to bigint for id types. However, despite knowing that this is supported from TSC 3.2.x, WebStorm is indicating an error with Unresolved type bigint. ...

The issue encountered during a POST request in Postman is a SyntaxError where a number is missing after the minus sign in a JSON object at position 1 (line 1

Running my API in a website application works flawlessly, but encountering SyntaxError when testing it in Postman - specifically "No number after minus sign in JSON at position 1" (line 1 column 2). The data is correctly inputted into the body of Postman a ...

Learn how to dynamically adjust context using a server-client architecture with TRPC

Currently, I am referring to the tRPC documentation for guidance on creating a server side caller. But I'm facing a challenge in dynamically setting the value when incorporating it into my NextJS 13 pages. In my context.ts file, you will find the fol ...

The autocomplete feature in Atom is not functioning as expected

Autocomplete+ is included with the installation of Atom and is activated by default. I have noticed that when I am coding, no suggestions are appearing. What could be causing this issue? Do I need to adjust any files in order for Autocomplete+ to functio ...

Is your JSON object receiving extraneous elements?

I received the following JSON output: {"OrderSummary":"[ {\"ProductQuantity\":\"1\", \"ProductName\":\"Wine\", \"Sellerid\":\"2\", \"ProductCost\":\ ...

Leveraging the power of ReactJS and TypeScript within a Visual Studio environment for an MVC5 project

I am currently working on creating a basic example using ReactJS and TypeScript in Visual Studio 2015. Despite following several tutorials, none of them have met my specific requirements or worked as expected. My goal is to develop components as .tsx fil ...

Is it possible to omit certain fields when using the select function in MikroORM?

When working with nested populate queries in MikroORM with MySQL, I am faced with the challenge of selecting 100 fields while wanting to exclude around 20 fields. It would make more sense to leave out those 20 fields, similar to using db.find().select("- ...

Comparison between rows using SQL in Oracle databases

I'm currently working on generating a matrix or crosstab with the rows provided below: TBL_CURRENCY_PAIR ID | ISO_1 | ISO_2 1 | EUR | USD 2 | JPY | USD 4 | GBP | USD My goal is to create an Oracle view that would display something similar ...

Similar to `util.inspect` in Node.js, Deno also has a function

Is there a utility function in Deno that can stringify an Object or primitive similar to Node.js util.inspect? For instance, if I have a JSON object in Node.js and want to display its contents: > m = {k1:'v1', k2:'v2'} { k1: ' ...

The error message "Type 'string | number' is not assignable to type 'number'" indicates a type mismatch in the code, where a value can be either

I encountered an error code while working with AngularJS to create a countdown timer. Can someone please assist me? //Rounding the remainders obtained above to the nearest whole number intervalinsecond = (intervalinsecond < 10) ? "0" + intervalinseco ...

Maximizing performance in SQL databases by optimizing queries that involve multiple column

I have created a SQL query in two different ways, but due to the large size of the data, both queries are taking quite a long time to retrieve the necessary information. Method 1: SELECT A.Col1, B.Col2 FROM TableA A LEFT JOIN TableB B ON ((A.C1= ...

Discover how to combine tables and apply various filters simultaneously using Dapper within an asp.net core mvc framework

I am attempting to query and join two tables with multiple conditions. string sql = "Select l.*, c.FirstName_CompanyName from dbo.Loan l left join Customer c on l.CustId=c.CustId where LoanAccountNo > 0 "; After implementing the above code, I realize ...

How to display a modal within a router-link in Vue 3?

Below are buttons with router-links. However, I only want the calculator button to open a modal. When I execute the code provided, all buttons trigger the modal instead of just the calculator button. Output: Router-link Code: <div class="contai ...