Skip to content
Daniel de Morais Compartilhe. Aprenda. Evolua.
StartDB StartDB

Banco de dados para iniciantes, by Daniel de Morais – InfoCotidiano

StartDB
StartDB

Banco de dados para iniciantes, by Daniel de Morais – InfoCotidiano

Obtendo informações sobre o banco MySQL / MariaDB

Daniel Morais,

Você que utiliza MySQL Server ou MariaDB e precisa obter informações como: se o banco existe, se a tabela existe, se o campo existe, se a view existe ou até mesmo se a procedure existe para fazer suas atualizações em tempo de execução, este vídeo é para você !

Verificando se a base de dados (schema) pdv existe:
show databases like 'pdv';
Verificando se a tabela produto existe no banco pdv:
SELECT table_name
FROM information_schema.tables
WHERE table_schema = 'pdv'
AND TABLE_TYPE = 'BASE TABLE'
AND table_name = 'produto';
Verificando se o campo DescProd existe na tabela produto no banco PDV
select * from information_schema.COLUMNS 
where TABLE_SCHEMA = 'pdv'
and TABLE_NAME  = 'produto'
and COLUMN_NAME  = 'DescProd'
Verificando se a view vw_venda existe na base pdv:
SELECT table_name
FROM information_schema.tables
WHERE table_schema = 'pdv'
AND TABLE_TYPE = ''
AND table_name = 'vw_venda';
Verificando se a procedure pr_ucAcesso existe na base pdv:
SHOW PROCEDURE STATUS 
where db = 'pdv' and name = 'pr_ucAcesso'
Dicas MySQL Mysql banco de dados existecampo existemariadbMysqlprocedure existetabela existeverificar se a base existe

Navegação de Post

Previous post
Next post

Posts recentes

  • Criptografando campos no MariaDB com AES
  • Backup Compactado MariaDB ou MySQL no Linux
  • Instalar PostgreSQL 14 no Windows 11
  • Migrando (exportar / importar ) registros de um banco de dados
  • Curso SQL Server #13 In

Categorias

  • Curso Firebird
  • Curso MySQL Server
  • Curso PostgreSQL
  • Curso SQL Server
  • Dicas
  • Dicas MySQL
  • Dicas PostgreSQL
  • Dicas SQL Server
  • Firebird
  • Inicio
  • Instalando MySQL
  • Instalando PostgreSQL
  • Mysql
  • PostgreSQL
  • SQL Server

Tags

add column agregar agregação alterar registro alter table apagar apagar registros atualizar avg between chave chave estrangeira consulta create database create table criar tabela delete drop database drop table extract filtro foreign key having in insert insert into instalar join junção key like mariadb media Mysql order postgresql primary key query select sql server subselect union update up date where

Obrigado pela visita!

©2026 StartDB | WordPress Theme by SuperbThemes