Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
19 views

DB Commands

The document shows SQL commands used to create a MySQL database and table, insert sample data, and run queries. It creates a database and table, inserts rows, and queries the table and MySQL port variable.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

DB Commands

The document shows SQL commands used to create a MySQL database and table, insert sample data, and run queries. It creates a database and table, inserts rows, and queries the table and MySQL port variable.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Enter password: ********

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 12

Server version: 8.0.36 MySQL Community Server - GPL

Copyright (c) 2000, 2024, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

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

mysql> CREATE DATABASE testdatabase;

Query OK, 1 row affected (0.01 sec)

mysql> USE testdatabase;

Database changed

mysql> CREATE TABLE library(Id integer Primary Key, Name varchar(100), title varchar(100),author
varchar(100),price integer, qty integer) ;

Query OK, 0 rows affected (0.09 sec)

mysql> desc library;

+--------+--------------+------+-----+---------+-------+

| Field | Type | Null | Key | Default | Extra |

+--------+--------------+------+-----+---------+-------+

| Id | int | NO | PRI | NULL | |

| Name | varchar(100) | YES | | NULL | |

| title | varchar(100) | YES | | NULL | |

| author | varchar(100) | YES | | NULL | |

| price | int | YES | | NULL | |


| qty | int | YES | | NULL | |

+--------+--------------+------+-----+---------+-------+

6 rows in set (0.02 sec)

mysql> SHOW VARIABLES WHERE Variable_name = 'port';

+---------------+-------+

| Variable_name | Value |

+---------------+-------+

| port | 3306 |

+---------------+-------+

1 row in set (0.02 sec)

mysql> select * from library;

+---------+----------+---------------+----------+-------+------+

| Id | Name | title | author | price | qty |

+---------+----------+---------------+----------+-------+------+

| 123 | Chandana | Corporate Law | xyz | 180 | 1 |

| 23456 | ABC | port | eeee | 456 | 2 |

| 7878787 | YYYYYU | sdfsfsdfdsf | sdfsdfsd | 45454 | 2 |

+---------+----------+---------------+----------+-------+------+

3 rows in set (0.00 sec)

mysql>

You might also like