How to leave a blank field in table in sqlplus? - sqlplus

In sql, if some fiels are to be left blank while inserting the values in the table, how shall we do it?
For eg. For name field, i want to insert 'First Name' & 'Last Name' but not 'Middle Name'.
But the field is already present by default in the table.

If I have understood you correctly, you simply need to execute an INSERT sentence, without using the columns (fields) you don't want to inform.
As an example, if you have three columns and don't want to inform column2 use
INSERT INTO table_name (column1,column3)
VALUES (value1,value3);
instead of
INSERT INTO table_name (column1,column2,column3)
VALUES (value1,value2,value3);
Hope it helps!

Related

How to use the the column as identifier

I need to know which row of a certain column starts with the letter "O".
I tried for this the query function.
I try to achieve this with a QUERY on a this Column. But the first row of the Column doesn't have a particular name. My question is how can I use the Column as identifier in a 'where query'
In this example I need to know in which row of column
=QUERY(A4:A30;"where columnA start with 'O'")
As advised by #JPV:
=QUERY(A4:A30;"where A starts with 'O'")
However, with FILTER is shorter:
=filter(A4:A30;Left(A4:A30)="O")

Activeadmin - Need to add two values and show it in third column

I am trying to add the values and introduce a new column in Activeadmin, so that when I add the values it automatically sum up the values and show it in the next column.
Image for reference:
Take a title to a column add add the required columns to it.
index do
selectable_column
column "New Column" do |your_model_name|
staff_salary.to_i + visa_&_medical.to_i
end
end
Refer here.

how to create default auto increment name in iPhone

I'm doing a project in iPhone where i'm using sqlite database. I have a text view where user can enter any text to create a note, and a text field where user can enter the name of that note. In database I've created two column 1st is note and 2nd is noteName, where noteName is the primary key. Now i want, if any user forget to enter the name of the note, then it will create a default name such as untitled name with a index which will increment automatically after every note creation.
Can anyone tell me how can I do that?
You can directly -- count the number of rows present in your table by a simple SELECT query.
And Append that "Count+1" number to noteName and insert that row in your database.

Reordering ADO Recordset columns

I have a recordset with columns
e.j
ID_PEOPLE
NAME
AGE
And I need to reorder this columns to
ID_PEOPLE
AGE
NAME
This recordset is used to fill an Excel spreadsheet and need to change the recordset column order because reordering in Excel is to slow.
Any idea?
Right click on your Table/Query, select Field Editor.
If there are not fields, press CTRL+F.
Drag by mouse fields changing order as you want.
Or, if you have a Query, you may change select field order: select Field2, Field1 from Table.
Or you may physicaly redesign field order in your table/view/procedure.

how to insert sqlite table date field value?

i have create table like below and inserting the value using insert query from ruby on rails but it's not updating the date value with table. Rest of the field values updating correctly....
give me
Table structure:
CREATE TABLE [Approval] (
[InstallationName] TEXT NULL PRIMARY KEY,
[Approver] TEXT NULL,
[ApprovalCRCdate] DATE NULL,
[ApprovalTime] TIME NULL,
[ApprovalCRC] NUMERIC NULL,
[ApprovalStatus] TEXT NULL
)
insert query:
insert into [Approval] values('_EGONSEOSX0043','dfgdfg','6/6/2011' ,'16:13:14' ,324234 ,'Approved')
maybe you should change the field's type to TEXT?
SQlite's DATE datatype has numeric affinity and you are using / that is not a number.
But I think it should all get inserted since SQLite has 'dynamic typing'

Resources