Sql where is not

sql where is not SELECT column1, column2, … FROM table_name WHERE NOT condition; sql where a or b — example SELECT Id, ProductName, UnitPrice, Package FROM Product WHERE ProductName LIKE ‘Cha_’ OR ProductName LIKE ‘Chan_’ sql and /* AND is a operator that allows you to combine two conditions Both conditions must be true for […]

Sql where is not Read More

Sql server import json

sql server import json SELECT * FROM OPENJSON (@JSON, ‘$.data.assets.parcels’) WITH (id VARCHAR(7), x INT, y INT, price INT ‘$.auction_price’) — new column name ) insert json into sql SELECT * FROM OPENJSON(@json) WITH (id int ‘strict $.id’, firstName nvarchar(50) ‘strict $.info.name’,   lastName nvarchar(50) ‘$.info.surname’, age int,   dateOfBirth datetime2) sql server import json […]

Sql server import json Read More

Sql primary keys

sql primary keys — NOTE: this is for SQL-Oracle specifically — syntax: SELECT cols.table_name, cols.column_name, cols.position, cons.status, cons.owner FROM all_constraints cons, all_cons_columns cols WHERE cols.table_name = ‘<table-name>’ — Replace <table-name> with your table-name AND cons.constraint_type = ‘P’ AND cons.constraint_name = cols.constraint_name AND cons.owner = cols.owner — example: SELECT cols.table_name, cols.column_name, cols.position, cons.status, cons.owner FROM all_constraints […]

Sql primary keys Read More

Sql how to query data json that store in field

sql how to query data json that store in field select * from employees where json_value(home_address,’$.state’)=’AR’ declare @json nvarchar(max) = N'{“employee”:[{“id”:1,”name”:{“first”:”Jane”,”middle”:”Laura”,”last”:”Jones”},”address”:{“home”:”11th Ave W”,”work”:”10th Ave W”,”city”:”Tampa”,”zipcode”:”33601″,”state”:”Florida”}}]}’;

Sql how to query data json that store in field Read More