Classs 11 Lab 1 ‐ Building a Database - Justin-Boyd/Ethical-Hacking-Class GitHub Wiki

Task 1: Building an SQL Database

Step 1

  • Start the Kali Linux virtual machine.

Step 2

  • Start the MariaDB service and create a database named cyber
  1. service mysql start
  2. mysql -u root -p
  3. create database cyber ;
  4. use cyber ;

Step 3

  • Create two tables: Attackers and Defenders. In each table add an ID, username, password, country, and another item of your choice. For each table, create five players with attributes of your choice.
  1. create table attackers(id INT(15), username VARCHAR(15), password VARCHAR(15), country VARCHAR(15), fruit VARCHAR(15));
  2. create table defenders(id INT(15), username VARCHAR(15), password VARCHAR(15), country VARCHAR(15), fruit VARCHAR(15));
  3. INSERT INTO attackers (id, username, password, country, fruit) VALUES (1234,'james','777','UK','apple');
  4. INSERT INTO defenders (id, username, password, country, fruit) VALUES (12,”alice”,”pass1”,”USA”,”banana”);

Task 2: Displaying Specific Data

Step 1

  • Display all the data in the Attackers and Defenders tables.
  1. select * from attackers ;
  2. select * from defenders ;

Step 2

  • Display both tables sorted in ascending ID order.
  1. select * from attackers order by id ;
  2. select * from defenders order by id ;

Step 3

  • Display both tables in a unified table using a single command.
  1. select * from attackers union select * from defenders ;