Sql group by

sql group by SELECT column_name(s) FROM table_name WHERE condition GROUP BY column_name(s) HAVING condition ORDER BY column_name(s); sql group by # Say you have a table called SALARIES that contains a # few duplicate NAME entries… +—-+————-+——–+ | ID | NAME | SALARY | +—-+————-+——–+ | 1 | Bob | 500 | | 2 | […]

Sql group by Read More

Sql format

sql format select [all/distinct] <col1>, <col2>, <col3> from <table_name> [join <join_condition>] [where <condition>] [group by <column_name>] [having <search_condition>] [order by <sort_specification>] /* Specifically for SQL -> Oracle LEGEND: […] : optional entries <…> : your specific entry */</sort_specification></search_condition></column_name></condition></join_condition></table_name></col3></col2></col1>

Sql format Read More

Sql developer post to endpoint

sql developer post to endpoint create or replace procedure publish_cinema_event ( p_room_id in varchar2 , p_party_size in number ) is   req utl_http.req;   res utl_http.resp;   url varchar2(4000) := ‘http://localhost:9002/cinema’;   name varchar2(4000);   buffer varchar2(4000);   content varchar2(4000) := ‘{“room”:”‘||p_room_id||'”, “partySize”:”‘||p_party_Size||'”}’;   begin   req := utl_http.begin_request(url, ‘POST’,’ HTTP/1.1′);   utl_http.set_header(req, ‘user-agent’, ‘mozilla/4.0’);   utl_http.set_header(req, ‘content-type’, ‘application/json’);   utl_http.set_header(req, ‘Content-Length’, length(content));     utl_http.write_text(req, […]

Sql developer post to endpoint Read More

Write a sql query to find the second maximum element from a table.

Write a SQL query to find the second maximum element from a table. SELECT name, MAX(salary) AS salary FROM employee WHERE salary < (SELECT MAX(salary) FROM employee); sql highest salary by location /* Highest salary by Department/Location */ SELECT e.ename, e.sal, e.deptno, d.loc FROM emp e JOIN dept d ON e.deptno = d.deptno WHERE e.sal […]

Write a sql query to find the second maximum element from a table. Read More

Update query in mysql

update mysql UPDATE table_name SET column1=value, column2=value2,… WHERE some_column=some_value mysql update query UPDATE table_name SET field1 = ‘value 1’, field2 = ‘value 2’ WHERE field3 = ‘value 3’ update query in mysql — Set New Employee Password UPDATE employee SET employee.password = ‘1234’ WHERE employee.email = ’[email protected]’; update mysql UPDATE table_name SET column1 = value1, […]

Update query in mysql Read More

Sql time format

sql time format DATE – format YYYY-MM-DD DATETIME – format: YYYY-MM-DD HH:MI:SS TIMESTAMP – format: YYYY-MM-DD HH:MI:SS YEAR – format YYYY or YY sql format select [all/distinct] <col1>, <col2>, <col3> from <table_name> [join <join_condition>] [where <condition>] [group by <column_name>] [having <search_condition>] [order by <sort_specification>] /* Specifically for SQL -> Oracle LEGEND: […] : optional entries […]

Sql time format Read More

Sql server joins

sql server joins SELECT Orders.OrderID, Customers.CustomerName, Orders.OrderDate FROM Orders INNER JOIN Customers ON Orders.CustomerID=Customers.CustomerID; join ms sql SELECT Orders.OrderID, Customers.CustomerName, Orders.OrderDate FROM Orders INNER JOIN Customers ON Orders.CustomerID=Customers.CustomerID;

Sql server joins Read More