0% found this document useful (0 votes)
14 views

SQL

Uploaded by

Het Bhavin Patel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

SQL

Uploaded by

Het Bhavin Patel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

┌──(patel㉿kali)-[~]

└─$ sudo systemctl start mysql

┌──(patel㉿kali)-[~]
└─$ sudo mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 42
Server version: 10.11.4-MariaDB-1 Debian 12

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> CREATE DATABASE sqldemo;


Query OK, 1 row affected (0.000 sec)

MariaDB [(none)]> use sqldemo;


Database changed

MariaDB [sqldemo]> CREATE TABLE users(username varchar(255), password varchar(255),


age int, PRIMARY KEY (username));
Query OK, 0 rows affected (0.004 sec)

MariaDB [sqldemo]> INSERT INTO users(username, password,age)


VALUES("jeremy","letmein",30);
Query OK, 1 row affected (0.001 sec)

MariaDB [sqldemo]> INSERT INTO users(username, password,age)


VALUES("jessamy","kittems",31);
Query OK, 1 row affected (0.001 sec)

MariaDB [sqldemo]> show databases;


+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sqldemo |
| sys |
+--------------------+
5 rows in set (0.001 sec)

MariaDB [information_schema]> use sqldemo


Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [sqldemo]> show tables
-> ;
+-------------------+
| Tables_in_sqldemo |
+-------------------+
| users |
+-------------------+
1 row in set (0.000 sec)
MariaDB [sqldemo]> use users;
ERROR 1049 (42000): Unknown database 'users'
MariaDB [sqldemo]> select * from users
-> ;
+----------+----------+------+
| username | password | age |
+----------+----------+------+
| jeremy | letmein | 30 |
| jessamy | kittems | 31 |
+----------+----------+------+
2 rows in set (0.001 sec)

MariaDB [sqldemo]> select age from users where username="jeremy"


-> ;
+------+
| age |
+------+
| 30 |
+------+
1 row in set (0.000 sec)

MariaDB [sqldemo]> select age from users where username="jeremy" or


username="jessamy";
+------+
| age |
+------+
| 30 |
| 31 |
+------+
2 rows in set (0.002 sec)

MariaDB [sqldemo]> select age from users where username="jeremy" and


username="jessamy";
Empty set (0.000 sec)

MariaDB [sqldemo]> select age from users where username="jeremy" union select
password from users;
+---------+
| age |
+---------+
| 30 |
| letmein |
| kittems |
+---------+
3 rows in set (0.002 sec)

MariaDB [sqldemo]> exit


Bye

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy