Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    MYSQL


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





How To Create A View Using Mysql 4.1?


how to create a view using mysql 4.1?




View Complete Forum Thread with Replies

Related Forum Messages:
MySQL 5.0.1 : CREATE VIEW And UNION
I don't manage to create a view from the UNION of two tables.

This statement works all right :
CREATE OR REPLACE VIEW myview AS SELECT 1 AS mycol UNION ALL SELECT mycol FROM mytable2;

This one does not :
CREATE OR REPLACE VIEW myview AS SELECT mycol FROM mytable1 UNION ALL SELECT mycol FROM mytable2;

and I get the error "ERROR 1143 (42000): create view command denied to user 'root'@'localhost' for column 'mycol' in table 'myview'", although I am creating the view using the "root" account.

Version used : MySQL 5.0.1 alpha snapshot (Windows binary).

View Replies !
How To Create Different Namespaces When Using CREATE VIEW?
I'm doing a triple join between tables which have similarly named fields...I was hoping that when using CREATE VIEW, the result would be a table with fields such as a.field, b.field, c.field...but I get an error "Duplicate column name 'field'"

...How can I get around this besides changing the name of the duplicate field in each table?

View Replies !
Create A View
I have a master table and five detail tables. Now I want to have an overwiew on all detail tables that are related to the master table. The problem is that there are to many repeated records.

My wish is that to have each record of detail table in a single row with master table information in the view table. I tried to reach this with joins (left or right). No chance.. Code:

View Replies !
Can't Create View
I am using MySQL 5.0.0 server Alpha release. Though the manual suggests that views on tables can be created in this version but i am unable to do so.

I have a table named 'ads'.
I am creating a view named 'test' with following syntax..
create view Test as select * from ads;

Msg returned by MySql is:
[MySQL] ERROR 1064: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'view Test as select * from ads' at line 1.

View Replies !
Create View
I currently have a script that I have developed on a MS SQL server. As part of it I use a VIEW to do most of my lookups. I want to transfer it to a MYSql DB, but when I try and CREATE VIEW I get the following message....


mysql> create table t (qty INT, price INT);
mysal> insert into t values (3, 50);
mysql> create view v as select qty from t;
ERROR 1064: You have an error in your SQL syntax. Check the manual that corresp
onds to your MySQL server version for the right syntax to use near 'view testv a
s select qty from t' at line 1
mysql>

I am using MYSQL for Netware. I am using an example that I have found to demostrate it, but it just does not work.

View Replies !
Create View Statements
I've read the help page on the mysql.org site but still cannot get

create view employee as select emp.name from emp, dept where
dept.id=emp.dept;

The select statement works fine on its own and I've changed the view name
a couple of times to avoid reserved words but still get Error 1064 : you
have an error in your sql syntax near... which leaves me none the wiser.

View Replies !
CREATE VIEW Statement
I'm trying to create a table view that will show the current day number of unique IP addresses taking into account previous days. For example, if the IP was logged yesterday or the week before I want to exclude it from todays count. I have a table logging item, ip, UNIX date. I can easily get total unique counts but have no idea how to do a current day count and exclude IPs from previous days.

View Replies !
Create View Question
I'm trying to create a view in mySQL Query Browser. But when i create the view i get the following error,

"Definer is not fully qualified"

Here is the view itself,



CREATE VIEW `dzoic`.`POLLS_vwNumAnsPerQuestion` AS
SELECT
COUNT(poll_answers.answer_id) AS NumAnswers,
poll_questions.question_id
FROM
poll_answers
INNER JOIN poll_questions ON poll_answers.question_id = poll_questions.question_id
GROUP BY
poll_questions.question_id
Now i've played with it a little and when i add a definer (DEFINER = `dzoic`) i get the following error,

Script line: 1Definer is not fully qualified
Script line: 1You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'VIEW `dzoic`.`POLLS_vwNumAnsPerQuestion` AS
SELECT
COUNT(poll_answers.an' at line 1
now i know there was an issue with a bug in mySQL versions prior 5.0.16 when creating a view. Currently the version of mySQL that i'm using is 5.0.18 and the bug was fixed by this release.



View Replies !
Inability To Show Create View
When I execute the command "show create view" while logged in as root I
get this error:
"select command denied to user 'root'@'%' for column (a table that
from which the view draws part of its data)"

I can select the data from the column using the standard select syntax.
I can also get the data from the view itself by running it using the
normal select syntax.

I presume there is some corruption here. I am unable to find a way to
repair a view in a manner similar to optimizing or repairing a table.

View Replies !
Join Tables + Create View
I have 2 tables when joined generates about 30k records. I need those results to join another table with about 174k records. I know I need to create a view right?
Not too sure how to do this since I use access to do it.
I will be importing to MySQL.

To make it more complicated, I need to join those results to another table with about 20k records. If I join all these tables, that would generate well over the millions. This is why I need to create a View. Is my logic correct? Please help me here since I donot know too much about MySQL.

View Replies !
Create View For Different Column Counts
trying to execute this statement:

create view first as select gene2accdb.gene2acc.tax_id, gene2accdb.gene2acc.gene_id, gene2accdb.gene2acc.pritein_gi from gene2accdb.gene2acc union distinct select namesdb.names.name_txt from namesdb.names union distinct select gene_info_db.gene_info.description from gene_info_db.gene_info;

I get error like this:

ERROR 1222 (21000): The used SELECT statements have a different number of columns

Tell me a way to overcome this error message.I want to create view or create mysqlorary table would work too.

View Replies !
Create View Error While Perform JOIN
Is that possible to do CREATE VIEW in a JOIN Syntax.
I write this kind of database command and receive error.

'CREATE VIEW tab1 AS SELECT * FROM customer JOIN TRANSACTION USING(CNo)'

mysql_exceptions.OperationalError: (1060, "Duplicate column name 'CNo'")

View Replies !
Cannot Create A Basic View Nor Stored Procedure, Error 1064
I need to do is to be able to create a view or a stored procedure.

I am using the basic, "create a stored procedure" tool via that button in MySQL Administrator. Anyway, my extremely basic view continually breaks.

I have a database called "bugs" from Bugzilla. I need to add a view to it. When I try and add this view, I get the 1064 syntax error.

CREATE OR REPLACE VIEW `bugs`.`view_MyBugsDescription` AS SELECT * from bugs

That should work. If I were using MS SQL Server, I would have finished this hours ago. What do I need to do with MySQL.

My version of MySQL Server is 4.1.20. MySQL client version is 5.0.11.

View Replies !
Why Do I Get "ERROR 1142 (42000): CREATE VIEW Command Denied To User..."
I can't figure out why I get the following error. When creating this user?

> create user 'callagga'@'localhost' identified by 'password';
> grant all on myequity_production.* to 'callagga'@'localhost' identified by 'password' with grant option;
> create view test_view as select * from transactions;ERROR 1142 (42000): CREATE VIEW command denied to user 'callagga'@'localhost' for table 'test_view'mysql>

Any ideas why? Note below in select * from db, all the fields are "Y" (i.e. doesn't this mean this user should have all privileges for this database).......

View Replies !
VIEW In MySQL
select NO_RESPONSABLE, NOM + PRENOM as NAME from RESPONSABLE

Gives me the number of the ID, but also "0" as the result of the
concatenated NAME.

View Replies !
Join On A View Without The View
I was wondering what the syntax would be to have a left join from one table to a resulting query without the view. Currently I use a view and it works fine but I was wondering how to achieve this without creating the view.

Here is the current view's SQL statement ( without the create view etc)...

View Replies !
How To View Catalog In MySQL
How can I query mysql to view the catalog? (By the catalog I mean the
special internal database that holds the meta-information about all
other databases in the system, including descriptions of all the tables
and their fields.) I know how to do this in psql, so I imagine there
is a similar facility in mysql. FWIW, my OS is Linux.

View Replies !
MySQL View Schema
If there's a MySQL command to view the schema of all the tables in a database.

View Replies !
MySQL View For A DB2 Database
I want to create a view in MYSQL, but the database/table is in a DB2 database. Is it possible ? I have heard that such a thing is possible between say ORACLE and SQL Server.

Bottom line, my tables are there in DB2, and i want to create a view in MySQL database. The reason of doing this is that i'm using Ruby/RubyonRails on AIX platform, since i could not find a DB2 Driver on AIX for RAILS, i want to go for this indirect approach.

(Rails works fine with MySQL). hence from Rails i want to access the MySQL (Indirectly to DB2)

View Replies !
View MYSQL TABLES VIA FTP
I have been asked to play around with the current website and make some changes etc, before i launch into it i want to get a good idea of how it is structured etc. It's written in PHP with a MYSQL backend.

I have setup a test environment on my local machine and copied the files from the existing site by grabbing them via FTP ... now everything runs via localhost except i cannot connect to mysql via phpmyadmin i played around with the settings in the config.inc.php file and it allowed me into phpmyadmin but there was no database??

How do i see the actual mysql tables or at least get a .sql file dump so i can recreate an identical test db ??

View Replies !
View Mysql Users Password
How can i view a mysql users account's password, i have got all privileges so it should be possible? When i have a look in the mysql table the passwords are coded.

View Replies !
MySQL View Using Data From Firebird Db
The website uses data from a MySQL database by I need to also access data from a Firebird database.

There is a common key between the 2 databases and I would like to create a View in MySQL that reads data from the Firebird database into the View and then displayed on the website. Is this possible in MySQL?

I know that I could use a PHP script in the website itself to do something similar, but I would prefer to perform this at the database level as I believe the performance would be better.

View Replies !
How Do I Turn On Logging To View Errors In MySQL 5
I'm a new MySQL user. Just switched over from the Bill Gates world and am joining the open source side finally. I setup a website using Joomla! 1.x with PHP5 and MySQL 5 on the backend.

However when I submit a post in my forum on my new site, the page goes blank yet says it's finished loading. In the Microsoft world you can echo back to the screen errors and figure out which row, record or table was causing the error.

Can you do the same using MySQL or does it have a logging feature that could help me troubleshoot and see why my posts are hanging when hitting the submit button via my browser?

View Replies !
Compare Temporary Table And View In Mysql
may i know that what is the dirrerences between temporary table and view (mysql), which method is more suitable in retrieve tons of data.

View Replies !
MySQL And Borland Database Engine And View
I have an application using Oracle and MSSQL with BDE, and I would extend it to support MySQL now. I have an error - 'invalid table name' - when I open a view. This is works with Oracle and MSSQL, but doesn't work with MySQL.

View Replies !
How Can I View A Mysql Database In A Html Table?
how I can view my database in a HTML table.

View Replies !
View The Timestamp In MySQL As The UNIX By Adding 0 To The End Of The Row
i've read that in MySQL 4.1, you can view the timestamp in MySQL as the UNIX by adding 0 to the end of the row. Can someone help me modify my code so that this same idea will also in my code?

<tr><td colspan="2">
<?php $datetime=$row["time" + 0];
$year = substr( $datetime, 0,4 );
$mon = substr( $datetime, 5,2 );
$day = substr( $datetime, 7,2 );
$hour = substr( $datetime, 9,2 );
$min = substr( $datetime, 11,2 );
$sec = substr( $datetime, 13,2);
$orgdate = date("l F dS, Y h:i A",
mktime( $hour, $min, $sec, $mon, $day, $year));


?>

<b>Date:</b> <?php echo $datetime; ?></td></tr>

View Replies !
MySQL View Points From Enterprise DBAs
One of our companies clients has asked us about redoing one of their highly profitable web applications in PHP and MySQL (The had an outside consultant recommend it). Their current application is built in C#.NET and SQL and is not currently clustered or load-balanced. They want to rebuild it as they have learned a lot about what they want since the original design and they know they need to make significant changes to the application to get the new features they are after and also address functionality that their current customers don't like.

The company contacted the original .NET author (who also happens to be an experienced Microsoft SQL DBA) to see about redoing the applciation in PHP and MySQL and the author panned MySQL and stated that their own company had attempted to migrate one of their applications to MySQL and that from his perspectives there were many things that causes A GREAT DEAL of extra DBA overhead.

I was hoping that more experienced DBAs using MySQL would be able to confirm or deny some of the Microsoft SQL DBAs claims - I have never worked with anything except MySQL and I have not used it for very long or even very often, so I am unable to successfully evaluate the claims.

By no means do I want to get into 'down with Microsoft' thread here.

Here are his claims:You can not centralize stored procedures for multiple databases. If you do you have to open up a whole lot of permissions that expose the system too much?The use of stored procedures and triggers is really complicated and you have to get down to a very low level of coding to understand, create or edit them, which makes the DBA's job harder and even once experienced more time-consuming?It lacks quite a few advanced features that Microsoft SQL has (he didn't cite which ones)?The upgrade path (of MySQL) is not standardizes so features that worked in version x are not guaranteed to work in version x.5 or y?There is no standardized way to backup and restore the databases and between the different methods there is a lack of compatibility. This means that backing up a MySQL database in one way - say for example MySQLdump and trying to restore it using phpMyAdmin or the MySQL administrator will not work.For those of you that have worked with different Databases do you think that MySQL is as easy to administrate and update as other Databases and even more specifically Microsoft SQL?

View Replies !
Unable To See Queries In MySQL In Database View Dreamweaver...
I have MySql running on my Mac using NaviCat, I have created a few tables and a Query, When I load Dreamweaver I can see the Tables but can not see the Query. Would anyone be able to help me with this?

View Replies !
How To View Arabic Data In MySQL Query Browser
I am making a website on linux and i am using a program called rekall to view the database and also the table was created using this program.

most of the data in the database are in Arabic and rekall views the data in an acceptable manner with some errors and without any configuration

but when I tried MySQL Query Browser on windows and several other programs including navicat, toad, heidiSQL all the arabic data was not viewable except the data in blobs which can be exported to extenal files

The website encoding is [ar-eg] and [utf-8]
I want to view the arabic data stored in the table using a windows program
and if the program is fast and simple it would be much better as I am not the one who is going to use it

View Replies !
MySQL VIEW -> MS Word Mail Merge - Grouping Problem
Basically I am trying to create a simple invoice system that takes a query of a particular set of customer orders in the form of a VIEW (see below) and then Microsoft Word's mail merge facilities access this VIEW and then do a mail merge based upon it. The fields in each invoice are things like ShopperID, address1, address2 and other customer info as well as the products bought along with the corresponding quantity, price and amount (this essentially being quantity*price) etc.

MySQL
CREATE OR REPLACE VIEW invoice AS     SELECT o.*, i.Product AS Product, i.price AS Price, i.qty AS qty, i.amount AS Amount    FROM orders o     INNER JOIN items_ordered i      ON i.ShopperID = o.ShopperID    WHERE o.DATE BETWEEN &#55614;&#57159;-10-01' AND &#55614;&#57159;-10-31'

MS Word's mail merge connects to the database and accesses the VIEW query results just fine. The problem arises with the grouping of products (along with their associated quantity, price etc.) under each Shopper (or ShopperID to be more precise). Now, in the VIEW above I did not GROUP BY ShopperID so I used GROUP_CONCAT in conjunction with GROUP BY ShopperID to get all the products bought by a customer on the same record.

MySQL
CREATE OR REPLACE VIEW invoice AS     SELECT o.*, GROUP_CONCAT(i.Product SEPARATOR '
') AS Product, GROUP_CONCAT(i.price SEPARATOR '
') AS Price, GROUP_CONCAT(i.qty SEPARATOR '
') AS qty, GROUP_CONCAT(i.amount SEPARATOR '
') AS Amount    FROM orders o     INNER JOIN items_ordered i      ON i.ShopperID = o.ShopperID    GROUP BY o.ShopperID    HAVING o.DATE BETWEEN &#55614;&#57159;-10-01' AND &#55614;&#57159;-10-31'
I thought this would work just fine but the strange thing is that MS Word displays the Product field correctly (which has been concatenated using a new line
) but it doesn't display anything for the quantity, price or amount fields. I have tried using different separators like ' / ' and ',' but the same problem occurs. Does anyone have any ideas about why it is doing this and how I can find a solution?

View Replies !
If I Create An Index With Multiple Fields Do I Still Need To Create Individual Ones?
I have a table where the name field can only contain duplicates when the user_id field is different, so I create an index with user_id,name. Now I was wondering if I want to search just for the user_id or the name field individually does this dual field index count, or should I create another index for the user_id and the name?

View Replies !
How To Create Index When Doing 'create Table As Select'
Code:
Create mysqlorary table mysql
AS SELECT
Name
FROM
EmployeeList
WHERE
Dept = 'XXX'

I would l ike to create an index on the field Name of the mysqlorary table mysql. I wonder if I can create the index on the fly by adding sth in the above statement.

View Replies !
Using A View
I want to use a view but I'm unsure how exactly MySQL handles a view and I can't seem to find anything about it in the docs. I guess my question is:

Is a view stored as a physical table or is it stored in memory or what? I'm asking because I want to make sure that if it is stored in memory that the amount of ram on my db server doesn't become an issue.

View Replies !
What Is A VIEW?
What is a VIEW?

Why when I go to chapter 23 does it tell me how to create, alter, and drop a view, but it doesn't say what it is or what they're used for? Maybe I missed it, but is there any place in the reference where a sentence starts, "A VIEW is...".

The closest I've come (looking outside of MySQL site) is a view is 'a predefined join of specified tables'.

I take that to mean it is essentially a shortcut to a specific data set relationship and based on that I can see how it is useful, but why isn't this concept defined in the manual? Is it really so obvious that it doesn't require any explanation, or god forbid a demonstration of how it is used?

Even more evidence that this is a stupid question is that when I google 'what is a mysql view' I get bounced back to the reference.

View Replies !
Is This Possible With A View?
I'm trying to cut down on the size of my database so I've changed it so that rather than implicitly setting every value in one table, I've split the data into two tables: one table (iData) contains data for the start of evey week:
iData
-----------------------------
2000-01-01 Volume: 20000000
2000-01-06 Volume: 30000000
2000-01-11 Volume: 40000000
Another table (jData) contains the delta (difference) from the previous iData entry:
jData
-----------------------------
2000-01-02 Volume: 1
2000-01-03 Volume: -2
2000-01-04 Volume: 1
2000-01-05 Volume: 3
2000-01-07 Volume: 2
2000-01-08 Volume: -5
2000-01-09 Volume: 6
2000-01-10 Volume: 1
2000-01-12 Volume: 2
2000-01-13 Volume: -4
2000-01-14 Volume: 4
2000-01-15 Volume: 3

Obviously this will save a lot of space as the delta is much smaller than storing the exact value (standard compression technique).

So what I would like to do is create a view to automatically display all of the data as if it were all stored in one table:

All Data:
---------
2000-01-01 Volume: 20000000
2000-01-02 Volume: 20000001
2000-01-03 Volume: 19999999
2000-01-04 Volume: 20000000
2000-01-05 Volume: 20000003
2000-01-06 Volume: 30000000
2000-01-07 Volume: 30000002
2000-01-08 Volume: 29999997
2000-01-09 Volume: 30000003
2000-01-10 Volume: 30000004
2000-01-11 Volume: 40000000
2000-01-12 Volume: 40000002
2000-01-13 Volume: 39999998
2000-01-14 Volume: 40000002
2000-01-15 Volume: 40000005

I know I can do this programatically, but is it possible to do this with a view? Any pointers would be much appreciated.



View Replies !
View With Parameters
can I put parameters into a view?

example

CREATE VIEW `dmz_sms`.`vwProva` AS
SELECT * FROM tb_sms where id=@ID;

I get error 1351.

View Replies !
View Schema
is there a tool to view a schematic of a MySQL DB I don't mean the .sql file I mean a pretty chart type schematic.

View Replies !
Mysqldump View
I try to dump the view definition and records using the following command.

mysqldump -uroot -psecret! --databases test --tables proxy_view > mytest.txt

What all I get is the view definition without records. What is the correct method of dumping a view?

View Replies !
View Dependencies
When creating a view, it will (almost certainly) take information from one or more existing tables/views in the database. If I come to the database with no knowledge about the view (other than its name), how can I determine which underlying tables it depends on?

(I can do this is PostgreSQL by performing queries against the pg_class & pg_depends internal tables but I haven't discovered any way of doing it in MySQL either with SQL queries or with the C API.

View Replies !
Exponential View
how to store numbers in exponential view to MySQL. E.g. 4,56e-9 = 0,00000000456

I have 4,56e-9 as a variable in perl and want to store it to MySQL. Decimal as typ seems not to work. Does i realy have to convert it to 0,00000000456?

View Replies !
VIEW Problem
I create the next view:

CREATE VIEW VideoDB.FindCustomer AS
SELECT id, last_name&' '&name&' '&initial AS cname, picture, birthday, birthday_already, account_type, rents, exp_date, deposit, exp_deposit, auto1, kinship1, auto2, kinship2,
auto3, kinship3, auto4, kinship4, auto5, kinship5, auto6, kinship6
FROM VideoDB.customers;

When I execute the next statement the result is 0:
select cname from videodb.findcustomer;

How can I concat the whole name.
last_name&' '&name&' '&initial AS cname

View Replies !
View Foreign Key
My problem is that after creating a foreign key, I cannot see in MySQL/phpMyAdmin that a column is a foreign key, here is an example of 2 tables (I wanted to create a table with users in a community an create a table=relationship which contains the information about which users know each other):

CREATE TABLE `user` (
`id` double NOT NULL auto_increment,
`security_code` varchar(50) NOT NULL,
`active` tinyint(1) NOT NULL,
PRIMARY KEY (`id`)
);

CREATE TABLE `knows` (
`user_id_1` double NOT NULL,
`user_id_2` double NOT NULL,
KEY `benutzer_id_1` (`benutzer_id_1`),
KEY `benutzer_id_2` (`benutzer_id_2`)
);

Now ... after creating (using the ALTER command of MySQL) two foreign keys (linking 'knows' with 'user') in the 'knows' database (which are of course 'user_id_1' and 'user_id_2') I cannot see any changes on my tables in phpMyAdmin. Why? After using the export function of phpMyAdmin, there is nothing about the foreign keys in the generated SQL. Why?
And another question concerning the relationship 'knows', would you give me some idea about how to create it in DBDesigner 4 or Workbench? There is something that I do not understand:
In school we learned a lot about ERM. And in ERM you were able to define attributes for relationships (for example 'date' for table 'knows', which would inform me about when we have added the info). In DBDesigner a relationship can only be made as a connection between Entities, but without any attributes. And how would I define such recursive relationship like 'knows' (from above) in DBDesigner 4 then, so that the tool would add to the relationships foreign keys automatically and export the relationship 'knows' as a table later on?

View Replies !
SQL Source For A View
How do you obtain the SQL source that created a View?

I can Describe the view, but that doesn't give me the SQL that created it.

. . .

I should have searched the forums a little longer. The answer lies in the

SHOW CREATE VIEW viewName statement.

View Replies !
If Condition In View
Basically i want to add put a where condition in a view if the user variable '@org_id' is > 0. Here is some pseudo code:

CREATE VIEW view_students AS
SELECT *
FROM students
If (@org_id > 0) THEN
WHERE org_id = @org_id
END IF

I've tried lots of different approaches but i just cant figure out how to do it.

View Replies !
View Optimization
In my database I have separate four tables and from that four tables i have created one view. Each of the table contains round five lacs of records. So when view gives result it is approximately around fifteen lacs of records,

When I call that view like "select * from MyView where name='vimal'" it takes too long to give me result. And due to this one query my application server load increases by 80%. When I execute this view that time mysql Memory consumption is approximately 80% of total memory. What I can do to optimize the same? What are the other alternatives?

View Replies !
Can't View Tables
I have a table located in the following directory. C:ProgramFilesMysqlDataRecipesTablesshirt.sql
The Database is Recipes and within that Database is another Database called Tables that has several tables I just used the shirt table as an example. How do I get to this table?

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved