This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
databases [2013/06/03 09:53] sandeep |
databases [2018/03/24 11:13] (current) |
||
|---|---|---|---|
| Line 73: | Line 73: | ||
| field not like '%' | field not like '%' | ||
| + | </code> | ||
| + | == Multiple constraints == | ||
| + | We can use and,or in SQL to support multiple constraints | ||
| + | <code sql> | ||
| + | SELECT * from tablename where n > 10 and b < 20; # Executes only if both a > 10 and b < 20 | ||
| + | SELECT * from tablename where n > 10 or b < 20; # Executes if any is true | ||
| </code> | </code> | ||
| + | == Getting Count== | ||
| + | <code sql> | ||
| + | SELECT count(*) from tablename; | ||
| + | </code> | ||
| + | === Update === | ||
| + | <code sql> | ||
| + | UPDATE tablename set field = value where field2 = value2; | ||
| + | </code> | ||
| - | === Update === | + | Multiple constraints apply here also. |
| === Insert === | === Insert === | ||
| + | <code sql> | ||
| + | INSERT INTO tablename values ( value1, value2, value3 ); | ||
| + | </code> | ||