I have just started learning Selenium.
I'd like to know how much knowledge of SQL I should have in order to be able to learn Selenium.
For writing Selenium tests itself, none. Selenium does not use SQL.
Now if the application under test uses SQL, maybe you need a bit of knowledge to setup test data for your tests. For basic SQL knowledge have a look at the free SQL course at Codecademy. This should probably be enough.
For Data Driven testing / Validation I used SQL Queries. It depends on your test scenario, Few Examples
- You perform a UI operation. Results are listed. You can perform the same query from DB and check records count match
- When you add a new user / delete a user from front end. You can perform DB query and validate records updated / deleted
- For multipage search results sql record count is easier to verify count of records in GUI / DB Query
Decent knowledge of SQL select query and joins is good enough for automation.
The key part of your question is "to learn selenium"
To learn selenium you don't need SQL knowledge inh order to be able to write good selenium test cases.
However a broader answer includes the following scale:
Junior Developer on a small system, tightly defined role using Selenium IDE with other frameworks available for querying data (e.g. RubyOnRails ActiveRecord). Here you would have a limited use for SQL and it would not be a requirement for learning this 'flavor' or usage of Selenium.
Mid-level developer on more complex systems that have several components and other systems that are interacted with, e.g. a service orientated architecture will find it hard to know what's really going under 'under the hood' without being able to do SQL queries to look at the records they are creating and updating through the web interface. They may my using the seleniumIDE with patterns such as Page Object or they may be using web driver in conjunction with programming languages such as C, Ruby, Python, Java, etc.
Senior Developers on complex system will find SQL knowledge and access essential to doing their job and being able to perform backend queries on complex data sets and conditions that are not exposed through the application interface. They use selenium with web driver and run cases both locally and remotely on test server providers. They understand workflows and how the back end data model is implemented in a Relational Database Management System and how it records transactions and state changes.
Unless you are doing any database or backend testing, you dont need any SQL knowledge for selenium. Selenium is a UI automation tool. In case if your test data is separated by any Database, you may require SQL queries to retrieve data from the DB; that would be only plain language + DB connection.