I'm having a hard time querying a table which has a column name 'default', it shows an error, I can't rename it because I'm using an old system and it might affect our previous systems.
e.g.
select * from table_name where default = 1
tried this
select * from table_name where 'default' = 1
and it didn't work.
Is there a workaround on this?
Certain columns and data types have predefined or assigned default values. For example, default column values for the various data types are as follows: NULL. 0 Used for small integer, integer, decimal, single-precision floating point, double-precision floating point, and decimal floating point data type.
The DEFAULT constraint is used to set a default value for a column. The default value will be added to all new records, if no other value is specified.
Select the column for which you want to specify a default value. In the Column Properties tab, enter the new default value in the Default Value or Binding property.
When using CREATE TABLE , you can specify default values for columns by typing DEFAULT and then the desired value after it. If a row is inserted that does not specify a value for that column, the database will fill it in with the default value instead.
You should use backtips:
select * from table_name where `default` = 1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With