+ 3

SQL in Sololearn

Is there any way to program/test SQL on Sololearn?

8th Sep 2024, 6:37 PM
Jakob
Jakob - avatar
9 Respostas
+ 4
Jakob I think this one is short enough. But you need to acknowledge that you need a database in the first place before you can run any "select", "insert", "delete" or "update" command. Therefore, there is a "create" command to build a database at the very beginning. https://sololearn.com/compiler-playground/cmOQV8Je8fF1/?ref=app
9th Sep 2024, 5:50 AM
Wong Hei Ming
Wong Hei Ming - avatar
+ 5
Somehow it would be done by using Python and sqlite3 library. And here is an example. https://sololearn.com/compiler-playground/cKqm1J8dX791/?ref=app
9th Sep 2024, 4:36 AM
Wong Hei Ming
Wong Hei Ming - avatar
+ 2
No, but I can recommend you the software called SQLite browser that let you do just that
8th Sep 2024, 8:31 PM
RuntimeTerror
RuntimeTerror - avatar
+ 1
Is there a shorter exemple? I'm new with SQL.
9th Sep 2024, 5:33 AM
Jakob
Jakob - avatar
+ 1
Is everything OK with you?
9th Sep 2024, 3:26 PM
Jakob
Jakob - avatar
+ 1
12th Sep 2024, 1:10 PM
Jakob
Jakob - avatar
+ 1
You almost get there. If you read the error message, it told you the error occurred at line 19, which is cur.execute(insert) In itself is a valid command, so we need to look into the variable (insert) passed to the command, which is defined between line 15 and 18. Line 15 and 16 looks fine, so as line 18. In line 17 (bluewale, 25), it looks like we are inserting 2 values into a record. However, the "bluewale" is a string doesn't surround by quote. If we change line 17 into: ('bluewale', 25) and run the code again, you get the result.
13th Sep 2024, 3:12 AM
Wong Hei Ming
Wong Hei Ming - avatar
+ 1
Thank You. Now it's working
13th Sep 2024, 1:42 PM
Jakob
Jakob - avatar
0
cmVxdWlyZSAiYmFzZTY0IgoKZW5jID0gQmFzZTY0LiBlbmNvZGU2NCggJ1NlbmQgcmVpbmZvcmNlbWVudHMnKQogICAgICAgICAgICAgICAgICAgICAjIC0+ICJVMlZ1WkNCeVpXbHVabTl5WTJWdFpXNTBjdz09XG4iCiBwbGFpbiA9IEJhc2U2NC4gZGVjb2RlNjQoIGVuYykKICAgICAgICAgICAgICAgICAgICAgIyAtPiAiU2VuZCByZWluZm9yY2VtZW50cyI=
9th Sep 2024, 2:26 PM
Pluto Paid
Pluto Paid - avatar