Questions tagged [fields]
33 questions
64
votes
2 answers
How does ORDER BY FIELD() in MySQL work internally
I understand how ORDER BY clause works and how the FIELD() function works.
What i want to understand is how the both of them work together to sort.
How are the rows retrieved and how is the sort order derived
+----+---------+
| id | name …
itz_nsn
- 806
- 1
- 7
- 7
34
votes
5 answers
Get column names and data types of a query, table or view
Is there a PostgreSQL query or command that returns the field names and field types of a query, table or view?
E.g., a solution if applied to simple SELECT query like SELECT * from person should return a list like:
Column Name | Column…
vfclists
- 1,093
- 4
- 14
- 21
32
votes
5 answers
Column vs Field: have I been using these terms incorrectly?
I feel kind of embarrassed here, I've always used the terms "column" and "field" completely interchangeably, which recently caused some confusion in a technical discussion.
I was told, though, that this wasn't correct, that it should be…
BradC
- 10,073
- 9
- 51
- 89
6
votes
2 answers
Efficiently write SELECT queries for tables with lots of columns (not SELECT *)
Due to limitations in my GIS software, I need to write select queries for each of my 200+ tables in my database. The queries need to select all columns, except for one, the SHAPE column.
Is there an efficient way to get all the field names for each…
User1974
- 1,517
- 25
- 54
4
votes
1 answer
Parsing COPY's binary format to access a tsrange
How is tsrange stored in binary?
For example create table
CREATE TABLE public.test (t tsrange);
INSERT INTO test VALUES ('[2010-01-01 14:30, 2010-01-01 15:30)');
INSERT INTO test VALUES ('[2011-01-01 14:31, 2015-11-01 15:30)');
INSERT INTO test…
eri
- 143
- 1
- 6
3
votes
1 answer
Microsoft Access: Using other fields in an Autonumber
I'm trying to use Microsoft Access to start an employee database. However, I want the display of the Employee ID to be the initials and then their number. For example, John Smith with the ID 0002 is JS0002. I've been playing around with format but…
Sally
- 31
- 1
3
votes
6 answers
Standards for storing a rating as a range (1-5, 1 is best, etc.)
I am designing a ROAD_INSPECTION table that has a CONDITION field:
+---------+-----------+
| ROAD_ID | CONDITION |
+---------+-----------+
| 1 | 2 |
| 2 | 5 |
| 3 | 1 |
| 4 | 1 |
| 5 | …
User1974
- 1,517
- 25
- 54
3
votes
0 answers
What is the difference between a field and a column?
Although I have always regarded the terms as interchangeable, I have read somewhere that they’re not the same. I suppose this means that a record is not exactly the same as a row either.
I teach that the main difference is how you visualise the data…
Manngo
- 3,065
- 10
- 38
- 61
2
votes
1 answer
Maximum number of fields/columns in MongoDB
I'm considering learning and using MongoDB for a project, but I'm going to need to be able to store at least 1024 columns for the first part, and as many as 1048577 for the second. Does MongoDB have a limit on the number of columns?
Qaz
- 213
- 3
- 11
2
votes
1 answer
Should I split these fields or leave as one?
I want to create a database listing characters in each book of the A Song of Ice and Fire series, listing the name of the character and the page in which they appear. I could just use three fields (not including the primary key,) Name,…
Lou
- 181
- 1
- 8
2
votes
0 answers
Can't add field that begins with an underscore in Crystal Reports
There's a field in a FoxPro table that I'm trying to pull in a Crystal Report (v10), and it begins with an _ and it doesn't appear in Field Explorer->Fields->Database Fields->->_fieldName
Are fields that start with _ invisible to Crystal…
leeand00
- 1,722
- 6
- 20
- 36
2
votes
2 answers
Should fields that are set to Not Null also have a constraint refusing empty strings?
Any field that I would expect a value (Like an orderNumber or customerNumber) I would set as not nullable.
If I'm expecting the value of the field to be not null, shouldn't I also always have a constraint that does not allow for zero length strings…
Elias
- 179
- 12
2
votes
1 answer
Identifying field changes between tables and consecutive rows
I need to build an audit report to identify field changes between two tables, as well as between consecutive rows in one of the tables. The first table (data) holds the current data:
id data_id field1 field2 data_dttm
1 100 data3 data3 …
Steve H.
- 23
- 5
1
vote
3 answers
Add fields to view from select (transpose fields)
I've got a table with following structure:
CREATE TABLE test
(
id integer,
field character varying,
value character varying
);
field value
------ -----
field1 value1
field2 value2
field3 value3
... ...
I need to…
Egidi
- 393
- 1
- 5
- 15
1
vote
1 answer
Product table with possible duplicate part numbers from different manufacturers
I am making a database. It has a product(aka component or part) table with a ID, ManufacturerID, and PartNumber. The ID is obviously the primary key and is unique. The ManufacturerID is pulled from the ManufacturerT. The PartNumber will be entered…
aknewhope
- 11
- 3