How would do the following in SQL “select dept names who have more than 2 employees whose salary is greater than 1000” ? DeptId DeptName —— ——– 1 one 2 two 3 three …
SQL Query with ORDER BY
I have a table in my SQL database that looks like: id type radius ————————- 1 type1 0.25 2 type2 0.59 3 type1 0.26 4 type1 0.78 5 type3 …
sql query: if any of the columns have even one word mentioned in a given array of words, select that entire row
I have the following sql query: select distinct * from tableName where contains ( (column1, column2, column3), ‘default’ ) This works fine. Instead of looking at just one keyword ‘default’ is it …
Dynamic Like Statement in SQL
I’ve been racking my brain on how to do this for a while, and i know that some genius on this site will have the answer. Basically i’m trying to do this: SELECT column FROM table WHERE [table].[…
MYSQL – count number of rows in each table
I would like to know how many rows are in each table in my database. I’ve come so far as to having However i would need to do that on each and every table – and there are a lot. What would me the best way to get a print-out with the table name and it’s row count? Answer I
What should I be indexing? Usernames or User IDs?
I have a fairly simple table (forgive errors / stupidity, I’m still learning. Written for MySQL): CREATE TABLE IF NOT EXISTS `userdata` ( `userid` UNSIGNED int(18446744073709551615) …
GROUP BY – do not group NULL
I’m trying to figure out a way to return results by using the group by function. GROUP BY is working as expected, but my question is: Is it possible to have a group by ignoring the NULL field. So that it does not group NULLs together because I still need all the rows where the specified field is NULL. S…
SQL Comments on Create Table on SQL Server 2008
I need to create some pretty big tables in SQL Server 2008, while I do have SQL Server Management Studio, I would like to comment the tables and the columns when I create the table. How do I do this? Example of the query I am running: I’ve tried COMMENT’Expiration Date for the Adult CPR’ and…
How to exclude rows that don’t join with another table?
I have two tables, one has primary key other has it as a foreign key. I want to pull data from the primary table, only if the secondary table does not have an entry containing it’s key. Sort of an …
SQL UPDATE Command
Question. I’m trying to use SQL to update a listview in C#. Using the Query Builder I can do a select, update, insert and delete. Ive got my select but I’m trying to get my update to work with no luck.( I want to use the update button on the listview to update the record) I need some insight as