How do you execute a query in Sequel Pro? - mysql

I want to execute a query in a MySQL DB using Sequel Pro, but I do not see a Run button.
How do I execute my query?

Use ⌘+R to execute the selected Query.
Alternatively, use the dropdown that appears at the bottom right of the query editor and select Run Current or Run Previous depending on where your text cursor is.

Based on Keyboard Shortcuts:
Run all queries ⌥ ⌘ R
Run current query or selection ⌅ or ⌘ R

Use the drop down button on the right side, underneath the textarea.
Should have the following options:
Run Current Query
Run All Queries

Came here to find ⌘ + return to execute a query (like MySQL Workbench).
Found that I can map using mac Key bindings with the names of Run Current Query and Run Previous Query.
If you want to do it via terminal it would be (untested):
defaults write com.sequelpro.SequelPro NSUserKeyEquivalents '{
"Run Current Query" = "#\\U21a9";
"Run Previous Query" = "#\\U21a9";
}'
Note: you may have to restart the app.

Related

Custom Delimiter in SQL Server Management Studio does not work

I'm trying to change my delimiter to a pipe:
I have restarted SQL Server Management Studio. However, I keep having the csv file with the previous delimiter.
Is it necessary to do something else?
You are setting custom delimiter for Results to Text option. But, you are trying to save results in the Results to Grid option.
If you are having Results to Text option (Shortcut Ctrl + T), you will get the result properly. You can copy and save the result accordingly.
update:
To turn off rowcount
SET NOROWCOUNT ON -- Add this setting before SELECT query
SELECT ...
Or in the
Tools > Options > Query Execution > SQL Server > Advanced > check SET NOROWCOUNT
To turn off completion time
Tools > Options > Query Execution > SQL Server > Advanced. Uncheck the
Show Completion Time checkbox

Couchbase CBQ Silent Fail

I'm trying to query a secure bucket via couchbase CBQon windows.
I've got couchbase/bin in my PATH and from the command line I am able to run this:
cbq -engine=http://localhost:8091 -c=hug_contenthub:password
seems to connect OK:
Connected to : http://localhost:8091/. Type Ctrl-D or \QUIT to exit.
Path to history file for the shell : C:\Users\kevin\.cbq_history
cbq>_
From here on I can't do anything except quit. I tried several commands:
cbq> select 1=1
> SELECT DISTINCT type FROM `beer-sample`
> create primary index on `beer-sample`
They are all ignored. No feedback at all. The only thing that changes is cqb> becomes "....>" the cqb bit is stripped off.
What am I missing here?
I'm relatively new to Couchbase Server, and I'm used to the old MS SQL ways, and so I think I had a similar problem.
My solution: I added a 'semicolon' at the end of each query.
I also tend to prefer to use the new Query Workbench tool instead of cbq when I'm just writing and tweaking N1QL queries. (But maybe that's just me).

MySQL Workbench - How do I set a value to NULL using the GUI? [duplicate]

I'm using the MySQL Query Browser (part of the MySQL GUI Tools) and need to change a field to NULL, but I can't figure out how to do it - if I delete the value it tries to update it to ''. Typing "NULL" makes it try to update to 'NULL' (a string).
I know I could just write a query to do it, but that defeats the entire purpose of the tool, no?
In MySQL Query Browser, right click on the cell and select 'Clear field content' while the focus is in another cell.
In MySQL Workbench, right click on the cell and select 'Set Field to NULL'.
In MySQL Workbench, with the cell selected, press Shift + Delete
Tested on 6.3.4.0
Right-click on that column and select the
'Set field to Null'
option from the context menu.
Removing the contents:
This works for some tools (sorry to hear it doesn't for yours).
This may not appear as null but will when you perform a query.
Shift + Delete
work well in MySql Workbench 8
I'd try Ctrl-0 (zero), because that works in some tools.

Executing Line/Multiple Lines Only in mySQL Query Browser

I already used Microsoft SQL Server 2005 and found really easy to execute single/multiple lines of an sql query.
Example:
insert into tablea
($vala, $valb, $valc)
values
($vala, $valb, $valc);
insert into tableb
($vala, $valb, $valc)
values
($vala, $valb, $valc);
How can I execute the second part only? In MSSQL i will highlight the second insert statment and press F5. How can do this in mySQL?
The problem is that you must be trying to execute your query from a Query Tab rather than from a Script Tab. Go to File -> New Script Tab and input your multiple statements there. Next click the execute button... that's it.
Hope it helps!
Machi
You can do this. When you have logged into MySQL query browser, and you write two complete statments such as:
select "hello world";
select "second query";
You will notice two blue dots on the left side of the window they are left of the line numbers. By default it will try to exec the first command. That might be why you see one command with white background and all the others with a grey background. The command that is white, is highlighted and it is the one that will be executed. You should be able to just click anywhere inside the second query to highlight it and then click the lightning bolt button (execute) to run it.
You can do this in MySQL, but you have to use mysqli. Click here for details:
http://php.net/manual/en/mysqli.quickstart.multiple-statement.php
In workbench, make sure the cursor is in the statement you want to execute and hit Ctrl+Enter.
Ctrl+Shift+Enter will run all statements consecutively in the window/document.
In addition if you have selected a statement, Ctrl+Shift+Enter will execute the selected statement only.
Does selecting the second part and "EXECUTE" help? If not, then I am not sure if such a use case is supported. You might want to try MySQL Workbench though.
well the issue here is that if i write the queries :
select "hello world";
select "second query";
and Execute it gives error -- when i select/highlight any one of them and execute it gives the same error -- so i have to either delete one of the queries or comment it out or use the script editor which doesn't work for me and lot of other users who have use MS SQL 2000,2005.
If there a solution for this -- ideally it should execute the query i select .
Just an opinion
Rohan

How to make a field NULL using MySQL GUI Tools?

I'm using the MySQL Query Browser (part of the MySQL GUI Tools) and need to change a field to NULL, but I can't figure out how to do it - if I delete the value it tries to update it to ''. Typing "NULL" makes it try to update to 'NULL' (a string).
I know I could just write a query to do it, but that defeats the entire purpose of the tool, no?
In MySQL Query Browser, right click on the cell and select 'Clear field content' while the focus is in another cell.
In MySQL Workbench, right click on the cell and select 'Set Field to NULL'.
In MySQL Workbench, with the cell selected, press Shift + Delete
Tested on 6.3.4.0
Right-click on that column and select the
'Set field to Null'
option from the context menu.
Removing the contents:
This works for some tools (sorry to hear it doesn't for yours).
This may not appear as null but will when you perform a query.
Shift + Delete
work well in MySql Workbench 8
I'd try Ctrl-0 (zero), because that works in some tools.