Category: Database
-
Convert Lat/Lng to X and Y Coordinates Using SQL: A Practical Guide
Learn how to project latitude/longitude coordinates into flat X/Y plane coordinates using SQL. Full T-SQL, PostgreSQL, MySQL, and SQLite examples with cosine correction and distance calculation.
-
[Solved] Entity framework – Violation of PRIMARY KEY constraint ‘…’. Cannot insert duplicate key in object ‘dbo…’ the duplicate key value is (…). The statement has been terminated.
If you are struggling to create a new record in a sql db when using entity framework and you are ending up with an error that looks like this: What this means is that in SQL databases often a table will have a primary key id. And this primary key is generated by the data…
-
SQL Cheat Sheet
List all rows in a table: SELECT * FROM table_name; List specific columns in a table: SELECT column1, column2 FROM table_name; Filter rows using a WHERE clause: SELECT * FROM table_name WHERE condition; Update rows in a table: UPDATE table_name SET column1 = value1, column2 = value2 WHERE condition; Insert rows into a table: INSERT…