Running SQL queries in VSCode - postgresql

I installed Postgresql extension in VSCode Editor. When I try to run SQL queries, it says "Language code not supported or defined". How to fix this problem?

The problem is, the code runner extension is trying to run the query, which does't support SQL queries. Try ctrl+shift+E to run the query (As available in mssql extension), or use pgsql extension, which is fixed clone of postgresql extension.

Related

How to get Visual Studio Code language support to recognize new functions in SQL syntax highlighting

I develop SQL scripts on Visual Studio Code for Mac (version 1.74.3). In writing dbt models (which are SQL scripts), Visual Studio Code does not recognize certain functions (INITCAP) in one instance as a built-in function and does not highlight this as such. Not the biggest deal, but this got me wondering if I can add INITCAP or other functions to a file or something to get VSC to treat it as a function name. Please help! I search though many Microsoft documentations, but cannot find it. Oh, my files have a .SQL extension so for the most part, the file is recognized as a SQL script.

PostgreSQL installation and running through terminal

I'm currently installing postgresql to learn about databases. I'm new in this field so please bear with me. I use Windows 7 Home Premium and installed PostgreSQL under C:/. So it went well without errors. Now I want to create database using the cmd. So I write createdb 'databaseName' under C:/PostgreSQL/10/bin. But then it wants a password. I'm trying to type any text but it doesn't let me.
Now I searched for solutions and I'm in a circus right now. In the tutorial I'm watching, the instructor installed postgres using 'brew' and just installed a PostgreSQL GUI. Then he runs psql 'databaseName' to use psql commands.
Do I need to install postgres using 'scoop' in windows? or it is the same thing as using the installer from the web? I really don't know what to do now. I'm sorry if this sounds stupid for some of you :/
btw, I think the instructor uses Git Bash while I use cmd of windows
Okay, for windows users who installed PostgreSQL using an installer from web, you don't need to use the cmd instead use the SQL Shell provided by the PostgreSQL itself.

Is it possible to set notepad++ as a query editor in db2

I have just installed db2 on windows 8.1 and I want to run some queries. Ideally it would be easier using an editor like notepad++ to edit the queries before running them on the db2 command line as opposed to using the db2 command line. How do I set it up?
I tried this link and it did not work for me.
https://www.databasejournal.com/features/db2/article.php/10896_3316861_3/DB2-Command-Line-Processor-Tips-and-Tricks.htm

How do you uninstall Postgis?

I had PostGis installed on my machine, and somehow, some files got corrupted. I want to uninstall and reinstall PostGIS to hopefully get things working again, but I am not sure how to go about this.
I am running Windows 8.1. I've tried searching for it in the Control Panel under Programs and Features but PostGIS doesn't show up there. I've also tried in the StackBuilder but there are no uninstall options.
A Google search also turned up nothing useful.
Has anyone done this before? Is it possible to uninstall and reinstall PostGIS with doing the same for the whole Postgres?
this work for me
And for remove postgis from your database run below query
drop extension PostGIS
To check postgisis version run query in query panel
SELECT PostGIS_full_version();

How to Launch MySQL shell script

I am testing MySQL Workbench as I could gather from the docs one way to launch MySQL from Windows Command Line as per:
http://dev.mysql.com/doc/mysql-windows-excerpt/5.0/en/windows-start-command-line.html is to look for the file installed with MySQL called "mysqld"
Now I could find the .exe file "mysqld", however when I double click it flashes and disappears.
Any idea or suggestions?
I am able to launch MySQL from its own icon, but not from the file above mentioned.
Using workbench 6.1 community
You are totally confusing the MySQL server (which mysqld.exe is) and MySQL Workbench (MySQLWorkbench.exe, another application). The MySQL command line client (which is totally independent of MySQL Workbench) can be started by opening a command window (cmd.exe) and running mysql from there (not mysqld). But as this is independent from MySQL Workbench (which is just another client, even though a much more sophisticated one), you need to call the MySQL Workbench executable if you want to run it. If you do that from a command prompt it will spit out a number of parameters you can use.