Database ua_dillards;
HELP TABLE deptinfo;
HELP COLUMN nullable FROM deptinfo;
.... writing these queries but always end up with this error:
... Error Code - 5628 Error Message - [Teradata Database] [TeraJDBC
15.10.00.05] [Error 5628] [SQLState HY000] Column nullable not found in UA_DILLARDS.deptinfo.,,,,, HELP!!
But column Nullable is present in data table... cross checked using HELP TABLE.
I am writing these queries in TERADATA VIEWPOINT.
for all the information about a column help column deptinfo.nullable;
or you may query the dbc-table directly
select ColumnName, Nullable from dbc.columnsV where databasename ='ua_dillards' and TableName = 'deptinfo'
Nullable is a column in the result set of a HELP TABLE.
The rows of that result are the columns in the table.
Btw, most people prefer SHOW TABLE over HELP TABLE.
Related
I am just learning the first steps of SQLite and I am trying to create a small database and I always get the error message - Error: no such column: "Duisburg".
Can someone help me what I am doing wrong here?
Thanks a lot.
sqlite> CREATE TABLE Wohnort (PLZ int, Wohnort varchar(255), PRIMARY KEY (PLZ));
sqlite> INSERT INTO Wohnort (PLZ, Wohnort) VALUES (45472,“Mülheim“),(58674,“Köln),(47137,“Duisburg“);
Error: no such column: “Duisburg“
I have been trying to update a datetime column using the following SQL Statement:
UPDATE HistoricData SET RecordDate=DATETIME(RecordDate,'60 minutes') WHERE DataStreamID=1 AND TimeFrameID=5
However, I keep getting the following error message:
NOT NULL Constraint Failed: HistoricData.RecordDate
If you could recommend the appropriate change to get this working, I would very much appreciate it.
I will attempt to attach a sample schema and data:
Table Data
Table Schema
After inspecting your DML, my only remaining concern was the datetime format you have in your table. I tried updating such a value as you did, and guess what, it returns NULL: http://sqlfiddle.com/#!7/f4651/10 Why? Because your strings (do notation) are not valid ISO-8601 strings. You probably need to simply replace the dots with dashes before updating (http://sqlfiddle.com/#!7/f4651/11).
I have a table SIGHTINGS(NAME, PERSON, LOCATION, SIGHTED), and I'm trying to insert a new row into that table with the following query:
INSERT INTO SIGHTINGS (NAME, PERSON, LOCATION, SIGHTED)
VALUES ('Douglas dustymaiden', 'Person B', 'Double Mountain', '2005-11-28');
But it's returning this error:
[2017-12-04 17:08:18] [1] [SQLITE_ERROR] SQL error or missing database (sub-select returns 6 columns - expected 1)
I've looked up the correct syntax for sqlite inserts here, and from what I can tell, the insert is written correctly. Can someone tell me why it's throwing this error instead of doing the insert? I'm using DataGrip 2017 if that helps identify any issues.
EDIT:
Here's the trigger I added to the database. The insert works without the trigger.
CREATE TRIGGER SightingLocationError
BEFORE INSERT ON SIGHTINGS
FOR EACH ROW
WHEN NEW.LOCATION NOT IN FEATURES
BEGIN
SELECT RAISE(ABORT, 'Error: Insert into the SIGHTINGS table references location that is not found in the database.');
END;
WHEN NEW.LOCATION NOT IN FEATURES
The FEATURES table has six columns, so the database does not know how it should search for the location value.
Use an explicit subquery to return the column you want to use for this:
WHEN NEW.LOCATION NOT IN (SELECT xxx FROM FEATURES)
I have a table in which there's a column of type BLOB. Another column is of type 'text'. Something like:
CREATE TABLE Tbl(TXT text, BLB blob);
Now I've inserted a few records using:
INSERT INTO Tbl(TXT) VALUES("whatever");
As you can see nothing was defined for BLB. But each time that I issue a query like:
SELECT * FROM 'Tbl' WHERE 'TXT'="whatever";
I get nothing at all without any error message or anything. My primary guess was that the problem might have something to do with BLB being null or undefined or something like that. Any ideas?
Your query should be:
SELECT * FROM Tbl WHERE TXT="whatever";
You are specifying strings for the table name and for the column. SQL lets you perform queries on values, not just tables.
This is the schema of my table:
create table LPCG(ID integer primary key, PCG text, Desc text, test text);
I wish to drop the column "test", and hence use the command:
alter table LPCG drop column test;
This is the error message I get:
Error: near "drop": syntax error
Can someone please help me correct my error?
An additional question is: I understand that ID is the primary key attribute. Would I be able to drop that column? If not, is there a workaround which anyone has used?
Thanks in advance for any help.
Up to version 3.35, SQLite did not support ALTER TABLE DROP COLUMN statements. You could only rename table, or add columns.
If you want to drop a column, your best option was to create a new table without the column, and to drop the old table in order to rename the new one.
As of now, ALTER TABLE support is still limited but includes dropping a column, under conditions.